NEW 141758
Finding an option in a select element shouldn't be reset when the user types a space
https://bugs.webkit.org/show_bug.cgi?id=141758
Summary Finding an option in a select element shouldn't be reset when the user types ...
Adele Peterson
Reported 2015-02-18 09:21:35 PST
Created attachment 246820 [details] Test case Finding an option in a select element shouldn't be reset when the user types a space. Steps to reproduce: 1) Load the attached test case 2) Hit tab twice to focus the select element 3) Type "United S" When you hit the space, the search string is reset, and when you next type "S", "Spain" is selected. I expect "United States" to be selected. Firefox behaves correctly, Chrome matches our behavior.
Attachments
Test case (159 bytes, text/html)
2015-02-18 09:21 PST, Adele Peterson
no flags
Adele Peterson
Comment 1 2015-02-18 09:33:12 PST
Adele Peterson
Comment 2 2015-02-22 21:12:09 PST
WebKit considers the event to be handled once the popup opens. I played around with trying to call typeAheadFind before opening the menu, but that doesn't really help. The searching WebKit does in the select element before the menu opens is separate from any searching that happens after the menu is open (which I think is handled by AppKit). So even if WebKit's search string includes the space, it doesn't help because the AppKit menu doesn't know anything about the characters that were typed before the menu was opened. So I think the challenge here is to find a way to pass this info along.
Abhijeet Kandalkar
Comment 3 2015-04-02 03:03:59 PDT
Ahmad Saleem
Comment 4 2022-09-18 03:27:53 PDT
Ryosuke Niwa
Comment 5 2022-09-18 18:47:52 PDT
The issue still reproduces in Safari whereas Chrome & Firefox will select "United States" upon typing "united s". The space after "united" is opening the popup instead of changing the selection to "united states".
Ahmad Saleem
Comment 6 2023-06-16 09:48:02 PDT
Potential merge - https://src.chromium.org/viewvc/blink?view=revision&revision=193280 ^ I merged locally with following changes: < In HTMLSelectElement.cpp > Line 1245: if ((keyCode == ' ' && !m_typeAhead.hasActiveSession(&keyboardEvent)) || keyCode == '\r') { in HTMLSelectElement::menuListDefaultEventHandler. _______ < In TypeAhead.h > bool hasActiveSession(KeyboardEvent*); _____ < In TypeAhead.cpp > bool TypeAhead::hasActiveSession(KeyboardEvent* event) { Seconds delta = event->timeStamp() - m_lastTypeTime; return delta <= typeAheadTimeout; } ______ This compiles but it does not fixed attached testcase. :-(
Note You need to log in before you can comment on or make changes to this bug.