Opened 9 years ago

Closed 9 years ago

#16977 closed defect (duplicate)

difficult to add more key handlers in dijit.Tree

Reported by: Adam Skwersky Owned by:
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


The dijit.Tree widget will create a key handler map to map keys to methods on the class. It creates and uses the map in _onKeyDown.

If we want to override Tree and add more key handlers we have to override the entire _onKeyDown method. This makes the code brittle because we have to duplicate the code in _onKeyDown. If a future Tree.js adds more key handlers too we won't get the handlers unless we update our code.

I propose a new method in dijit.Tree which would create the key handler map. Then we could override that method (calling the inherited method to get the dijit.Tree defined key handlers) and then adding our own.

After upgrading dojo recently we already ran into a problem where we were not handling the key handler map correctly. In that case we were not calling the handlers correctly (a new member was added to the message object passed to the handlers, and our method wasn't passing this in). If we had a key handler factory method then we would not need to override the entire _onKeyDown method.

Change History (1)

comment:1 Changed 9 years ago by bill

Component: GeneralDijit
Resolution: duplicate
Status: newclosed

Duplicate of #16967.
You filed the same exact ticket yesterday.

Note: See TracTickets for help on using tickets.