reserved
command
element.Here, the command to open a new browser window is reserved:
<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()" reserved="true"/>
If the keyboard shortcut for that is accel-t, then this code will not work as expected, as compared to when it is run from web content:
document.addEventListener("keydown", handleKey, true); function handleKey(event) { // Listen for the "New Tab" shortcut if (event.metaKey && (event.key == "t")) { // Log a message console.log("intercepted accel-t"); // Prevent the default browser action event.preventDefault(); event.stopPropagation(); } }
Currently, this event handler as coded above runs and logs the message, but the default behavior persists. In future releases, the event handler will never be called for the given keyboard shortcut.