Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crm457 326 offence list #212

Merged
merged 30 commits into from
Aug 11, 2023
Merged

Crm457 326 offence list #212

merged 30 commits into from
Aug 11, 2023

Conversation

ivanELEC
Copy link
Contributor

@ivanELEC ivanELEC commented Aug 8, 2023

Description of change

  • Added offence type to Offence
  • Used a template for main offence suggestion autocomplete to include offence type as well as description

Link to relevant ticket

Update main offence list

Notes for reviewer

The clearUndefinedSuggestions() function is a pretty awkward and not very good workaround for a bug in the accessible-autocomplete - as it stands

Screenshots of changes (if applicable)

Before changes:

image

After changes:

image

TO DO

  • Change on hover/selected styling of text in accessible autocomplete's list items to be white instead of grey to fix contrast issues
  • Add tests for JS code
  • Error handling where necessary (this may include figuring out a different way of doing the autocomplete bug workaround as it isnt airtight by any means)

ivanELEC added 24 commits August 3, 2023 15:10
Placeholder function as proof of concept for when DOMContentLoaded to show all of the templates for each offence
Added code to claim_type page
- code works for main offence field when page is rendered and when submission fails
- offences are retrieved from offences endpoint EACH time the autocomplete input is queried, need to understand if there's a method of caching this in via the JS
- data isn't being submitted into the form, need to understand why
Also added workaround for known bug of accessible-autocomplete (alphagov/accessible-autocomplete#424) where using templates shows "undefined" on first click/focus

Need to fix contrast issues on highlight
This breaks accessible autocomplete
- Use constants for Main Offence Types
- Use optional chain expression instead of &&
- Search now includes offence type also
- Offence request has an expiry age so that it can be cached
- Change offence description to offence name in request
- Better conditional handling of suggestion template
- suggestion_select has default data_module attribute instead of using custom flag
- use data_module to identify offence select tags instead of element id
- when simulated in capybara with selenium, for some reason, the option doesn't auto select so have to click on the selection
@ivanELEC ivanELEC marked this pull request as ready for review August 10, 2023 14:08
@ivanELEC ivanELEC requested review from a team as code owners August 10, 2023 14:08
@ivanELEC ivanELEC requested review from a team August 10, 2023 14:08
dwhenry
dwhenry previously approved these changes Aug 10, 2023
app/views/steps/case_details/edit.html.erb Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ivanELEC ivanELEC merged commit 3ca4807 into main Aug 11, 2023
@ivanELEC ivanELEC deleted the CRM457-326-OffenceList branch August 11, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants