[Webkit-unassigned] [Bug 51897] Escape should clear search field
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jul 14 01:24:03 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=51897
--- Comment #5 from Kent Tamura <tkent at chromium.org> 2011-07-14 01:24:03 PST ---
(From update of attachment 100667)
View in context: https://bugs.webkit.org/attachment.cgi?id=100667&action=review
>>> LayoutTests/fast/forms/input-search-press-escape-key.html:28
>>> + eventSender.keyDown("escape");
>>
>> Do you need to use eventSender?
>> Doesn't the following event dispatching work?
>> var event = document.createEvent('KeyboardEvents');
>> event.initKeyboardEvent(...);
>> input.dispatchEvent(event);
>
> Keyboard event dispatching does fire the event but does nothing because of the bug: http://code.google.com/p/chromium/issues/detail?id=52408
> This bug happens on not only Linux Chromium 14.0.822.0 but also Mac Safari 5.0.5 and even Linux Firefox 5.0.
>
> You can test it here:
> http://haraken.info/null/keyevent.html
>
> Provided that the above test code is not wrong, I am not sure but I guess that this is not a bug and there must be some strong reason (security or something?) that browsers are forbidding dispatching keyboard events. But if this is really a bug to be fixed and you think that we should first fix the keyboard event dispatching bug, then I will fix it and then come back to this search form bug later.
ok, I understand createEvent&initKeyboardEvet doesn't work.
>>>> 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.
--
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