Reputation: 919
I am using Dojo 1.2 to implement some functionality on my customer's webpage. One of the widgets I use is the dijit.layout.TabContainer
, which inherits StackContainer
. The StackContainer
subscribes on keyboard events and creates a few hotkeys, like arrow left to move one tab to the left and so on.
Now to the question: I would like to disable this hotkey feature in my TabContainer
. Is there a configuration option I can set (can't find any in the API) to achieve this, or will have to hack the Dojo code or perhaps create my own versions of StackContainer
and TabContainer
in order to rid myself of the hotkeys? I would of course prefer not to mess with the Dojo code.
Best regards / Fredrik
Upvotes: 2
Views: 818
Reputation: 32117
I'm just coding off the cuff here, and I didn't test it out at all. I'm making this wikified, so post the correct source if there are any problems, please.
Use the following javascript within a file called com/stackoverflow/KeyPresslessTabContainer.js
:
dojo.provide("com.stackoverflow. KeyPresslessTabContainer");
dojo.require("dijit.layout. TabContainer");
dojo.declare("com.stackoverflow.KeyPresslessTabContainer", dijit.layout. TabContainer, {
_controllerWidget: "com.stackoverflow.KeyPresslessTabController"
});
dojo.declare("com.stackoverflow.KeyPresslessTabController", dijit.layout.TabController, {
/*
* this is the important part. The original code was:
* templateString: "<div wairole='tablist' dojoAttachEvent='onkeypress:onkeypress'></div>"
* In the template below, we remove the onkeypress listener,
* and thus key presses should be ignored.
*/
templateString: "<div wairole='tablist'></div>"
});
Upvotes: 0
Reputation:
Simply override _onKeyPress with an empty body:
<div dojoType='dijit.layout.TabContainer'> <script type='dojo/method' event='_onKeyPress'></script> ... <div>
Works like a charm.
Upvotes: 2