mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1128175 - add explicit <esc> handler, r=jaws
This commit is contained in:
parent
3bfd694773
commit
1db091fedc
@ -222,6 +222,11 @@ let gSubDialog = {
|
||||
},
|
||||
|
||||
_onKeyDown: function(aEvent) {
|
||||
if (aEvent.currentTarget == window && aEvent.keyCode == aEvent.DOM_VK_ESCAPE &&
|
||||
!aEvent.defaultPrevented) {
|
||||
this.close(aEvent);
|
||||
return;
|
||||
}
|
||||
if (aEvent.keyCode != aEvent.DOM_VK_TAB ||
|
||||
aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey) {
|
||||
return;
|
||||
@ -278,6 +283,10 @@ let gSubDialog = {
|
||||
this._frame.addEventListener("load", this);
|
||||
|
||||
chromeBrowser.addEventListener("unload", this, true);
|
||||
// Ensure we get <esc> keypresses even if nothing in the subdialog is focusable
|
||||
// (happens on OS X when only text inputs and lists are focusable, and
|
||||
// the subdialog only has checkboxes/radiobuttons/buttons)
|
||||
window.addEventListener("keydown", this, true);
|
||||
},
|
||||
|
||||
_removeDialogEventListeners: function() {
|
||||
@ -290,6 +299,7 @@ let gSubDialog = {
|
||||
window.removeEventListener("DOMFrameContentLoaded", this, true);
|
||||
this._frame.removeEventListener("load", this);
|
||||
this._frame.contentWindow.removeEventListener("dialogclosing", this);
|
||||
window.removeEventListener("keydown", this, true);
|
||||
this._untrapFocus();
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user