[Webkit-unassigned] [Bug 51897] Escape should clear search field

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 14 14:45:52 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=51897





--- Comment #6 from Ojan Vafai <ojan at chromium.org>  2011-07-14 14:45:52 PST ---
(From update of attachment 100667)
View in context: https://bugs.webkit.org/attachment.cgi?id=100667&action=review

>>>>> Source/WebCore/html/SearchInputType.cpp:113
>>>>> +        TextFieldInputType::handleKeydownEvent(event);
>>>> 
>>>> Does this mean it's impossible for content to handle 'esc' specially?  I wonder if this maybe belongs on keypress rather than keydown.
>>> 
>>> Agree with Evan.
>> 
>> I am not sure for this. I agree that it becomes impossible for content to handle 'Escape', if we handle it in handleKeydownEvent(). However, it seems that most key events for input elements are being handled not by handleKeypressEvent() but by handleKeydownEvent(). For example, TextFieldInputType.cpp, NumberInputType.cpp and RangeInputType.cpp have handleKeydownEvent() but do not have handleKeypressEvent(). Also, if we handle 'Escape' in handleKeypressEvent(), then it becomes impossible to test it by eventSender.keyDown("escape") (, although whether we should test it by eventSender.keyDown() or not is debatable as I described above).
> 
> I think many existing key-binding code should be switched to keypress.
> eventSender.keyDown() dispatched keydown, keyup, and keypress.

Looking at EventDispatcher::dispatchEvent, we first fire the event to JS and then call defaultEventHandler. haraken, can you confirm that if you call preventDefault from the esc key's keydown event that we don't clear the search input?

That said, I think tkent is probably right that most, if not all, of the existing key-binding code should be moved to handleKeyPressEvent. I'm not 100% sure of that though. Would be nice to get input from someone involved in putting it on handleKeydownEvent in the first place. haraken, you could look at the blame list for some other instances of it and CC the appropriate developers on this bug to get them to comment.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list