Skip to content

Commit

Permalink
Editor menubar example: Make Escape close submenu when focus in menub…
Browse files Browse the repository at this point in the history
…ar (pull #723)

For issue #451:
* Adds ability to close open submenu  with Escape key when focus is in menubar.
* Add row to menubar keyboard table for Escape key.
  • Loading branch information
jongund authored and mcking65 committed Jun 24, 2018
1 parent 0dfdc87 commit d9a1f79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/menubar/menubar-2/js/MenubarItemAction.js
Expand Up @@ -126,6 +126,13 @@ MenubarItemAction.prototype.handleKeydown = function (event) {
flag = true;
break;

case this.keyCode.ESC:
if (this.popupMenu) {
this.popupMenu.close();
}
flag = true;
break;

default:
if (isPrintableCharacter(char)) {
this.menubar.setFocusByFirstCharacter(this, char);
Expand Down
8 changes: 8 additions & 0 deletions examples/menubar/menubar-2/menubar-2.html
Expand Up @@ -159,6 +159,14 @@ <h3 id="kbd1_label">Menubar</h3>
</th>
<td>Opens submenu and moves focus to first item in the submenu.</td>
</tr>
<tr>
<th>
<kbd>Escape</kbd>
</th>
<td>
If a submenu is open, closes it. Otherwise, does nothing.
</td>
</tr>
<tr>
<th>
<kbd>Right Arrow</kbd>
Expand Down

0 comments on commit d9a1f79

Please sign in to comment.