views:

63

answers:

0

So I'm having some trouble overriding some dijit default functionality. By default, the arrow keys will traverse through the container if possible (if there's more than one). It does this for dijit.layout.TabContainer, dijit.layout.AccordianContainer, etc.

Now from what I see all key events are published by dijit.layout.StackContainer as containerKeyPress events. dijit.layout.StackController listens for these events and then handles them accordingly.

So a dijit.layout.TabContainer for instance, has-a dijit.layout.TabController, which inherits StackController's stuff. Also TabContainer inherits dijit.layout._TabContainerBase which inherits StackContainer. And Hence all the functionality is covered.

So it appears to me that if I wanted to stop key event handling, I just need to override the publish in StackContainer:

   <div dojoType="dijit.layout.TabContainer" id="tabs" region="center" splitter="true">
            <script type="dojo/method" event="_onKeyPress">
                console.log("Victory");
            </script>
            ...
   </div>

I can see via the DOM in firebug that the method was overridden, but it just never gets called. Same thing if I try to just connect, never fires.

The closest I've gotten are a connect/override to "_transition" and "onKeyDown". But they apparently don't fire early enough to stop anything, they just get called later. Right now I'm getting lost trying to find out where these methods get called, because apparently this transition from tab to tab or pane to pane is not handled by the _onKeyPress publish method in StackContainer.

I realize this is a pretty specific question, but if anyone has done anything overriding default functionality of any dijit Containers feel free to chime in as it might help point me in the right direction.

I've been looking at source code for dojo 1.4.1, as that's what I'm using.