Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17109 closed defect (fixed)

_KeyNavMixin: blocking browser shortcut keys using meta key (on mac)

Reported by: allencblee Owned by: bill
Priority: undecided Milestone: 1.9.1
Component: Dijit Version: 1.9.0
Keywords: Cc:
Blocked By: Blocking:

Description

When dijit.Tree has the focus, the browser shortcut keys (like Command-Q) are somehow trapped and do not function. This happens in 1.9.0 but not in 1.8.3.

Change History (6)

comment:1 Changed 6 years ago by allencblee

I found the cause of the problem. It's because the _onContainerKeydown and _onContainerKeypress procedures in _KeyNavMixin.js forgot to check the evt.metaKey (i.e. Command key in Mac) in addition to evt.AltKey? and evt.CtrlKey?. Thus eating up all the browser shortcut keys.

comment:2 Changed 6 years ago by bill

Milestone: tbd1.9.1
Status: newassigned
Summary: Browser shortcut keys not working in dijit.Tree_KeyNavMixin: blocking browser shortcut keys using meta key (on mac)

Hi @allencblee, the _onContainerKeyDown only calls preventDefault when a handler is present, right?

_onContainerKeydown: function(evt){
        ...

        var func = this._keyNavCodes[evt.keyCode];
        if(func){
                // this branch should only fire if the Tree (or whatever is monitoring for the key)
                ...
        }else if(evt.keyCode == keys.SPACE && this._searchTimer && !(evt.ctrlKey || evt.altKey)){
                // and this branch only fires on SPACE key
                ...
        }
},

But I do see that _onContainerKeyPress is too liberal with calling preventDefault():

_onContainerKeypress: function(evt){
        ...

// this should check meta too right?
        if(evt.charCode < keys.SPACE || (evt.ctrlKey || evt.altKey) || (evt.charCode == keys.SPACE && this._searchTimer)){
                // Avoid duplicate events on firefox (this is an arrow key that will be handled by keydown handler)
                return;
        }
        ...
},
Version 0, edited 6 years ago by bill (next)

comment:3 Changed 6 years ago by allencblee

@Bill, you're right about _onContainerKeydown. Just fixing _onContainerKeypress is enough to fix this problem.

comment:4 Changed 6 years ago by bill

Note that Command-Q still works on Chrome, but the problem appears on FF.

Last edited 6 years ago by bill (previous) (diff)

comment:5 Changed 6 years ago by Bill Keese

Resolution: fixed
Status: assignedclosed

Account from meta key on mac, fixes #17109

Changeset: da6ffc528ea0093d8962243c49c5468a15ff6641

comment:6 Changed 6 years ago by Bill Keese

Account from meta key on mac, fixes #17109

Changeset: 222bfe16c259e7ff7078f7395d28a242951fda55

Note: See TracTickets for help on using tickets.