don't consume all keys

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2019-11-28 20:51:21 +00:00
parent 29b59dde5b
commit bfb5706b4a
1 changed files with 9 additions and 3 deletions

View File

@ -183,6 +183,8 @@ export class ContextMenu extends React.Component {
};
_onKeyDown = (ev) => {
let handled = true;
switch (ev.key) {
case Key.TAB:
case Key.ESCAPE:
@ -200,11 +202,15 @@ export class ContextMenu extends React.Component {
case Key.END:
this._onMoveFocusHomeEnd(this.state.contextMenuElem, false);
break;
default:
handled = false;
}
// consume all other keys in context menu
ev.stopPropagation();
ev.preventDefault();
if (handled) {
// consume all other keys in context menu
ev.stopPropagation();
ev.preventDefault();
}
};
renderMenu(hasBackground=this.props.hasBackground) {