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:
mozilla.mano%sent.com 2005-05-17 18:02:04 +00:00
Родитель 40e8b7f18a
Коммит 9383b9a69e
3 изменённых файлов: 21 добавлений и 20 удалений

Просмотреть файл

@ -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>