diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index d8565b2d2e1..1e698488a54 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -623,9 +623,21 @@ publicWidget.registry.hoverableDropdown = animations.Animation.extend({ return; } } + // Get the previously focused element of the page. + const focusedEl = this.el.ownerDocument.querySelector(":focus") + || window.frameElement && window.frameElement.ownerDocument.querySelector(":focus"); + // The user must click on the dropdown if he is on mobile (no way to // hover) or if the dropdown is the (or in the) extra menu ('+'). this._updateDropdownVisibility(ev, true); + + // Keep the focus on the previously focused element if any, otherwise do + // not focus the dropdown on hover. + if (focusedEl) { + focusedEl.focus(); + } else { + ev.currentTarget.querySelector(".dropdown-toggle").blur(); + } }, /** * @private diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss index c53079cd376..01f5e3a88b5 100644 --- a/addons/website/static/src/scss/website.scss +++ b/addons/website/static/src/scss/website.scss @@ -996,10 +996,6 @@ $-transition-duration: 200ms; } } -.o_hoverable_dropdown .nav-link.dropdown-toggle:focus { - outline: none; -} - // Navbar .navbar .o_extra_menu_items > .show { > li {