Skip to content

Commit f7f585c

Browse files
committed
Ignore Enter key up event on menu button toggles
Like links, buttons generate a "click" event as well as the regular "keydown" and "keyup" events when pressing Enter. Due to this, if both the "click" and the "keyup" events are handled, when the menu is open and Enter is pressed in the toggle the menu is first hidden when the first event is handled, but then shown again when the second event is handled. To prevent that only the "click" event should be handled when the toggle is a button, like it is already done with links. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent d647f33 commit f7f585c

7 files changed

Lines changed: 8 additions & 8 deletions

File tree

core/js/dist/login.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/dist/login.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/dist/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/dist/maintenance.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/dist/maintenance.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/OC/menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ let currentMenuToggle = null
3939
export const registerMenu = ($toggle, $menuEl, toggle, headerMenu) => {
4040
$menuEl.addClass('menu')
4141

42-
// On link, the enter key trigger a click event
42+
// On link and button, the enter key trigger a click event
4343
// Only use the click to avoid two fired events
44-
$toggle.on($toggle.prop('tagName') === 'A'
44+
$toggle.on(($toggle.prop('tagName') === 'A' || $toggle.prop('tagName') === 'BUTTON')
4545
? 'click.menu'
4646
: 'click.menu keyup.menu', function (event) {
4747
// prevent the link event (append anchor to URL)

0 commit comments

Comments
 (0)