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.
rdar://problem/19875341
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.
Related chromium issue : https://code.google.com/p/chromium/issues/detail?id=473050
I think this is added already here: https://github.com/WebKit/WebKit/blob/5a8883c75f0a425515a601a4eb8de66e88ada97d/Source/WebCore/html/HTMLSelectElement.cpp#L1213 rniwa@webkit.org - Can you confirm? Thanks!
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".
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. :-(