bcgov / bcparks-ar-admin

BCParks Attendance and Revenue Admin
Apache License 2.0
4 stars 11 forks source link

Unable to select sub-area #325

Closed JLWade closed 6 months ago

JLWade commented 6 months ago

How to replicate:

  1. go to A&R prod, enter data
  2. click on a month and Goldstream Park
  3. Try to select Goldstream Cooridor OR Goldstream Picnic Site
  4. Click go It defaults to "Goldstream" sub-area and user is unable to select "Goldstream Corridor" or "Goldstream Picnic Site".

Expected Behavior:

cameronpettit commented 6 months ago

The typeahead in the ngds-forms package uses string matching when selecting typeahead options. It picks the first option with a string match with what you selected, but it used to work on a word by word basis. If you selected Goldstream Corridor, the string matcher would look for Goldstream and Corridor individually, which lead to the incorrect subarea Goldstream getting selected first.

The typeahead in the form engine has been updated to require a 100% string match now, so Goldstream Corridor must match 'Goldstream Corridor' in its entirety.

It would be bad practice for a typeahead to have two options that share the exact same display string (eg two options that both say Goldstream Corridor but refer to different subareas). A console warning has been added to the form engine to alert developers when they are designing such a typeahead.

No code change necessary from an A&R standpoint so I am going to move this all the way to PROD.

manuji commented 6 months ago

Tested on PROD: Passed

JLWade commented 6 months ago

working for me in prod - moving to done