зеркало из https://github.com/mozilla/gecko-dev.git
Fix 53896, spacebar when HTML buttons/radiobuttons/checkboxes have the focus just scrolls the page. patch by saari. r=danm a=hyatt, rtm+
This commit is contained in:
Родитель
54c9df8633
Коммит
b6403eea7d
|
@ -271,6 +271,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEven
|
|||
mHandlerElement->GetAttribute(kNameSpaceID_None, kOnCommandAtom, handlerText);
|
||||
if (handlerText.IsEmpty())
|
||||
return NS_ERROR_FAILURE; // For whatever reason, they didn't give us anything to do.
|
||||
aEvent->PreventDefault(); // Preventing default for XUL key handlers
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,6 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, nsIAtom*
|
|||
rec = do_QueryInterface(elt);
|
||||
rv = currHandler->ExecuteHandler(rec, aKeyEvent);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aKeyEvent->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,6 +271,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEven
|
|||
mHandlerElement->GetAttribute(kNameSpaceID_None, kOnCommandAtom, handlerText);
|
||||
if (handlerText.IsEmpty())
|
||||
return NS_ERROR_FAILURE; // For whatever reason, they didn't give us anything to do.
|
||||
aEvent->PreventDefault(); // Preventing default for XUL key handlers
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,6 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, nsIAtom*
|
|||
rec = do_QueryInterface(elt);
|
||||
rv = currHandler->ExecuteHandler(rec, aKeyEvent);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aKeyEvent->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,19 @@
|
|||
<handler event="keypress" key=" ">
|
||||
<![CDATA[
|
||||
var v = document.commandDispatcher.focusedElement;
|
||||
|
||||
if (v && (v.localName == 'TEXTAREA'))
|
||||
return true;
|
||||
|
||||
if (v && (v.localName == 'TEXTAREA')) {
|
||||
return true;
|
||||
}
|
||||
if (v && v.localName == 'INPUT') {
|
||||
var str = v.getAttribute('type').toLowerCase();
|
||||
if (str == 'button' || str == 'submit' || str == 'reset') {
|
||||
return true;
|
||||
}
|
||||
str = v.getAttribute('TYPE').toLowerCase();
|
||||
if (str == 'button' || str == 'submit' || str == 'reset') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
|
||||
controller.doCommand('cmd_scrollPageDown');
|
||||
|
@ -20,7 +29,6 @@
|
|||
return true;
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче