Bug 37789
Summary: | <input type="search"> Cancel Button Should Fire an Event | ||
---|---|---|---|
Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | annevk, StevenGBrown, tkent |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | OS X 10.5 |
Joseph Pecoraro
Web Developers want to be able to detect when the user pressed the Cancel button in a search input. Currently there is no reliable way to detect this. I think firing an event makes sense.
I would suggest firing a bubbling, non-cancelable "cancel" event from the input element.
The following would be an example of usage:
<input type="search" id="x">
<script>
var elem = document.getElementById('x')
elem.addEventListener('cancel', function(e) {
alert('You Clicked Cancel!');
// e.target would be elem
}, false);
</script>
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
See also: bug 34393.
Kent Tamura
Since r63929, WebKit dispatches 'input' event immediately on the cancel button click, and will dispatch 'change' event when the focus is moved from the input field. I think this behavior is enough.
Anne van Kesteren
Agreed with comment 2.