Search code examples
javascriptdojo

How do I disable hotkeys in Dojo StackContainer


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


Solution

  • Simply override _onKeyPress with an empty body:

    <div dojoType='dijit.layout.TabContainer'>
    <script type='dojo/method' event='_onKeyPress'></script>
    ...
    <div>
    

    Works like a charm.