mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 294290 - Port patch from bug 225563 to toolkit (keyboard activation of <html:a> in an XUL page needs to prevent activation of the default OK button). patch from Gavin Sharp <gavin.sharp.gmail.com> r=neil, a=asa
This commit is contained in:
parent
40e8b7f18a
commit
9383b9a69e
@ -171,6 +171,8 @@
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_RETURN" preventdefault="true"/>
|
||||
<handler event="keypress" keycode="VK_ENTER" preventdefault="true"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -361,17 +361,8 @@
|
||||
<parameter name="evt"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var target = evt.originalTarget;
|
||||
if ((target.localName == "textarea")&&(target.namespaceURI == "http://www.w3.org/1999/xhtml")) {
|
||||
if (!this.enterDefaultAlways && evt.getPreventDefault())
|
||||
return;
|
||||
}
|
||||
// if a button is focused, do nothing, so that activating the button
|
||||
// doesn't cause the dialog to exit
|
||||
if (!this.enterDefaultAlways) {
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused.localName == "button")
|
||||
return;
|
||||
}
|
||||
|
||||
// only accept dialog if accept button is the default
|
||||
var btn = this.getButton("accept");
|
||||
@ -384,9 +375,14 @@
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" action="this.cancelDialog();"/>
|
||||
<handler event="keypress" keycode="VK_ENTER"
|
||||
group="system" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_RETURN"
|
||||
group="system" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" group="system">
|
||||
if (!event.getPreventDefault())
|
||||
this.cancelDialog();
|
||||
</handler>
|
||||
#ifdef XP_MACOSX
|
||||
<handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/>
|
||||
#endif
|
||||
|
@ -374,12 +374,10 @@
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<parameter name="evt"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// if a button is focused, dispatch its command instead
|
||||
// of advancing the wizard
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (!(focused && focused.localName == "button"))
|
||||
if (!evt.getPreventDefault())
|
||||
this.advance();
|
||||
]]>
|
||||
</body>
|
||||
@ -413,9 +411,14 @@
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this._hitEnter()"/>
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this._hitEnter()"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" action="this.cancel();"/>
|
||||
<handler event="keypress" keycode="VK_ENTER"
|
||||
group="system" action="this._hitEnter(event)"/>
|
||||
<handler event="keypress" keycode="VK_RETURN"
|
||||
group="system" action="this._hitEnter(event)"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" group="system">
|
||||
if (!event.getPreventDefault())
|
||||
this.cancel();
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user