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:
blakeross%telocity.com 2000-10-11 03:47:45 +00:00
Родитель 54c9df8633
Коммит b6403eea7d
5 изменённых файлов: 15 добавлений и 7 удалений

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

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