datalist-polyfill icon indicating copy to clipboard operation
datalist-polyfill copied to clipboard

Change event does not work as expected

Open jenstornell opened this issue 3 years ago • 2 comments

I fire a change event on my input with datalist. In Chrome and Edge (native behaviour), it fire the event as soon as I press enter on an item. With the polyfill (in Firefox) the item is set to the input on enter, which means I need to press enter one more time in order for the event to fire.

jenstornell avatar Sep 15 '20 06:09 jenstornell

@jenstornell thanks a lot for your feedback.

I've recognized that this seems to be the standard behaviour in Firefox for <datalist> HTML element, independently from the usage of this polyfill. So in general I agree with you that it's bad to have this inconsistency, but I sadly don't know the exact specified behaviour (either one might be incorrect). Have you already done some research on this aspect? And what would you suggest? I think to remember that triggering an event in this case might be a little problematic, as we both wouldn't want to "browser (version) detect" and as well couldn't feature detect the differences in event handling, and that for should rather get aligned at the browser level than solving it within the polyfill.

mfranzke avatar Sep 17 '20 19:09 mfranzke

@mfranzke I've just noticed that it works differently in Chrome + Edge (native) compared to Firefox (polyfill). I've not investigated it more than that.

You can leave this open or close it depending on if you want / can fix it or not.

jenstornell avatar Sep 18 '20 05:09 jenstornell