bootstrap-autocomplete icon indicating copy to clipboard operation
bootstrap-autocomplete copied to clipboard

TAB keyup should be ignored/not trigger ajax request & dropdown

Open micschk opened this issue 4 years ago • 3 comments

Currently when using the tab-key to cycle through form-fields, upon focussing on an autocomplete-field which already has a value, the TAB keyup event on that field will trigger the ajax call & dropdown for that field.

IMO autocomplete should not be triggered by a TAB keyup as that's typically used to jump from one field to another.

micschk avatar Apr 14 '21 10:04 micschk

TAB confirms the item selected in the autocomplete. I need to investigate these edge cases to prevent some bad behavior.

xcash avatar Apr 14 '21 12:04 xcash

This isn't related to TAB confirming the item selected in the autocomplete. This is TAB triggering handlerTyped (via falling through to the 'default' in the keyUp switch statement around line 250) when the user tabs into or out of an input, which fundamentally breaks the behavior of html forms (and is also very bad for accessibility). The user does not expect a search to happen and a dropdown to show up for a field they've already tabbed away from, or for a search to happen on the extant value for a field that they tab into.

You just need to add a 'case 9:' with no action in the 'switch' that starts on line 252 in main.ts. Tested this locally and confirmed it fixes this issue and does not affect the dropdown.

machinehum avatar Aug 26 '21 22:08 machinehum

Pull request opened (128).

machinehum avatar Aug 27 '21 00:08 machinehum