hmrc / assets-frontend

Deprecated static assets for frontends on MDTP.
Apache License 2.0
16 stars 64 forks source link

autoComplete does not handle non-uniques when typing #717

Open automaticdreams opened 7 years ago

automaticdreams commented 7 years ago

If a user does not interact with the suggestion list, but simply types their entry, and there are multiple suggestions that match their typing, autoComplete defaults to the first matching option

rpowis commented 7 years ago

@automaticdreams Can you give an example gif? What's supposed to happen instead?

automaticdreams commented 7 years ago

I don't know what should happen

This is edge case, so for example for Dominican republic, which has three possible title/value pairs and only when a user who does have javascript, chooses not to interact with the suggestion list, e.g. Dominican Republic / 1809 Dominican Republic / 1829 Dominican Republic / 1849

The requirement is that a user (when typing) only has to type the country, not the country code too. If the user simply types "Dominican Republic", and does not interact with the suggestion list, there is no way to interpret the user's intention

I don't have any suggestions about how to fix this

rpowis commented 7 years ago

Ah I see. This feels like a design issue then. It would be easier to just let the user type their country code rather than only being able to select it from a list no?

automaticdreams commented 7 years ago

yes, needs some design love..... do most users know their country code? could the autocomplete accept the user typing either country OR code? should it force users to type the '+'

automaticdreams commented 7 years ago

Or should we reconsider whether an autocomplete is appropriate here at all, and just use the select....?

rpowis commented 7 years ago

Is there actually a use case where a user would type their country and then not interact with the suggestions?

The purpose of the list is to choose a country code, not a country. I'd have thought the use cases for the list would be:

  1. The user can't remember their code in which case the list would help jog their memory.
  2. The user doesn't know their code in which case the list doesn't help if they're presented with more than one result. Presumably leaving them having to use other means to find out.

In both cases, they'd end up in the same position as someone who does know their country code. In which case they can either interact with the list to select the right one or type the code directly into a country code input.

automaticdreams commented 7 years ago

it's more a case that a user is able to type in and not interact with the suggestion list they are never asked to type their country code

rpowis commented 7 years ago

But that's the information we're ultimately trying to get out of them in this case isn't it?

automaticdreams commented 7 years ago

yes, I know....

rpowis commented 7 years ago

If that's the case, I'm not sure this should be an issue raised against the autocomplete pattern (as yes, I'd suspect a select would work better here) and is indicative of a larger issue:

How do I know if this is the pattern I should be using for this use case or not? And when/how/who do I raise that with in order to either a) come up with more suitable pattern b) design the form more appropriately using existing patterns?

These, however, are process problems and ones we're trying to solve on a bigger scale than github issues affords

feedmypixel commented 7 years ago

a lot of this discussion is also in the original PR https://github.com/hmrc/assets-frontend/pull/714