#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 8 years ago by
comment:2 Changed 8 years ago by
Milestone: | tbd → 1.9.1 |
---|---|
Status: | new → assigned |
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 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; } ... },
comment:3 Changed 8 years ago by
@Bill, you're right about _onContainerKeydown. Just fixing _onContainerKeypress is enough to fix this problem.
comment:4 Changed 8 years ago by
Note that Command-Q still works on Chrome, but the problem appears on FF.
comment:5 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Account from meta key on mac, fixes #17109
Changeset: da6ffc528ea0093d8962243c49c5468a15ff6641
comment:6 Changed 8 years ago by
Account from meta key on mac, fixes #17109
Changeset: 222bfe16c259e7ff7078f7395d28a242951fda55
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.