josephfrazier / reported-web

Web front-end for https://twitter.com/Reported_NYC: https://reported-web.herokuapp.com
https://reported-web.herokuapp.com
MIT License
10 stars 1 forks source link

Disable browser autocomplete for plate and description fields #525

Closed josephfrazier closed 5 months ago

josephfrazier commented 5 months ago

On June 16 2024, A user reported problems with the plate and description fields: https://reportedcab.slack.com/archives/C9VNM3DL4/p1718555738990569

Two related iOS web app autocorrect issues that seem to have arisen in the past 60 days:

  1. plate: "In some circumstances (see below), a correct lookup will appear as an autocomplete suggestion in the middle (preferred) position, as in this image, but tapping it doesn’t cause it to fill in in the form (instead your autocomplete suggestions reset)"

  2. description: "related: when there is a correct autocomplete suggestion in that position, keyboard expansion within the field doesn’t work (this must be new, otherwise I wouldn’t be so annoyed when it happens)"

And also said that "It happens when there is something in the form field already, but i think only in SOME circumstances" and "swiping away from chrome and then right back resets keyboard expansion to work correctly again".

While there hadn't been any relevant-looking changes over the past 60 days mentioned, I suspect that iOS/Chrome may have changed something that causes the autocomplete attribute functionality (which does suggest previously entered plates) to interfere with the datalist element functionality we're using to provide suggestions from ALPR, so let's try disabling autocomplete on the plate and description fields and see if it helps.

See also my message at https://reportedcab.slack.com/archives/C9VNM3DL4/p1719275322574669?thread_ts=1718555738.990569&cid=C9VNM3DL4:

so.... the plate autosuggest is done via the datalist element, which allows the website to make suggestions. On the other hand, the autocomplete attribute is for when we want to let the browser make suggestions.

If the correct plate is appearing as a suggestion, that should mean that the ALPR process correctly read the license plate. That said, I think the browser does try to autocomplete the field based on previous values (I've attached a screenshot of this happening for me in Firefox on macOS), so maybe the two functionalities are interfering with each other.

I'll try adding autocomplete=off to the license plate input and description textarea, though it sounds like browsers may not always honor that value