Wait with focusing until the dropdown as slided out and do not focus hidden input elements

pull/10506/head
Henriette Darge 3 years ago
parent 50c24af822
commit ea60741d49
  1. 6
      frontend/src/app/core/setup/globals/global-listeners/top-menu.ts

@ -199,7 +199,7 @@ export class TopMenu {
slideAndFocus(dropdown:JQuery, callback:any) {
this.slideDown(dropdown, callback);
this.focusFirstInputOrLink(dropdown);
setTimeout(() => this.focusFirstInputOrLink(dropdown), ANIMATION_RATE_MS);
}
slideDown(dropdown:JQuery, callback:any) {
@ -223,8 +223,8 @@ export class TopMenu {
// If there is ANY input, it will have precedence over links,
// i.e. links will only get focused, if there is NO input whatsoever
focusFirstInputOrLink(dropdown:JQuery) {
const focusable = dropdown.find('input:not([disabled]), a[href], area[href], select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]');
focusFirstInputOrLink(dropdown:JQuery):void {
const focusable = dropdown.find('.op-app-menu--dropdown').find('input:not([disabled]):not([type="hidden"]), a[href], area[href], select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]');
const toFocus = focusable[0];
if (!toFocus) {
return;

Loading…
Cancel
Save