Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-08-25 18:18:26 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-08-28 10:46:02 +0300
commitcb93af66758cb2da9221340d0abbedebdb444e93 (patch)
treedbc0022fb6c5a8d281bc6cd814e2961f16c32ba6 /core/src
parent976625fd4a7d80a61907a0fc70bfcba69414cbde (diff)
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>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/OC/menu.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/OC/menu.js b/core/src/OC/menu.js
index a0ecd2a5f4f..04d0e078b9a 100644
--- a/core/src/OC/menu.js
+++ b/core/src/OC/menu.js
@@ -39,9 +39,9 @@ let currentMenuToggle = null
export const registerMenu = ($toggle, $menuEl, toggle, headerMenu) => {
$menuEl.addClass('menu')
- // On link, the enter key trigger a click event
+ // On link and button, the enter key trigger a click event
// Only use the click to avoid two fired events
- $toggle.on($toggle.prop('tagName') === 'A'
+ $toggle.on(($toggle.prop('tagName') === 'A' || $toggle.prop('tagName') === 'BUTTON')
? 'click.menu'
: 'click.menu keyup.menu', function (event) {
// prevent the link event (append anchor to URL)