From 1737468f29247c83cb301dff9cb9872ecce2450d Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 30 Jan 2025 09:39:42 +0100 Subject: [PATCH] fix(NcActions): Remove on `mousemove` listener for auto focus elements 1. This causes issues with the native datetime picker on Safari as the mouse move is also considered outside when hovering a picker popover that overlays other actions. 2. In general this is very unexpected behavior, e.g. click on a text input, type something, move the mouse and keep typing. You expect to write to the same input but the focus is changed to a different while typing. Signed-off-by: Ferdinand Thiessen --- src/assets/action.scss | 6 +++++- src/components/NcActions/NcActions.vue | 26 -------------------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/assets/action.scss b/src/assets/action.scss index 5fd8488461..37b2ac1296 100644 --- a/src/assets/action.scss +++ b/src/assets/action.scss @@ -5,11 +5,15 @@ @mixin action-active { li.action { + &:hover, &.active { - background-color: var(--color-background-hover); border-radius: 6px; padding: 0; } + + &:hover { + background-color: var(--color-background-hover); + } } } diff --git a/src/components/NcActions/NcActions.vue b/src/components/NcActions/NcActions.vue index dabad14826..6cb27f4e31 100644 --- a/src/components/NcActions/NcActions.vue +++ b/src/components/NcActions/NcActions.vue @@ -1525,31 +1525,6 @@ export default { getFocusableMenuItemElements() { return this.$refs.menu.querySelectorAll(focusableSelector) }, - /** - * Focus nearest focusable item on mouse move. - * DO NOT change the focus if the target is already focused - * this will prevent issues with input being unfocused - * on mouse move - * @param {PointerEvent} event - The mouse move event - */ - onMouseFocusAction(event) { - if (document.activeElement === event.target) { - return - } - - const menuItem = event.target.closest('li') - if (menuItem && this.$refs.menu.contains(menuItem)) { - const focusableItem = menuItem.querySelector(focusableSelector) - if (focusableItem) { - const focusList = this.getFocusableMenuItemElements() - const focusIndex = [...focusList].indexOf(focusableItem) - if (focusIndex > -1) { - this.focusIndex = focusIndex - this.focusAction() - } - } - } - }, /** * Dispatches the keydown listener to different handlers * @@ -1969,7 +1944,6 @@ export default { }, on: { keydown: this.onKeydown, - mousemove: this.onMouseFocusAction, }, ref: 'menu', }, [