Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

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

Henriette Dargeea60741d498c
diff --git a/frontend/src/app/core/setup/globals/global-listeners/top-menu.ts b/frontend/src/app/core/setup/globals/global-listeners/top-menu.ts
index b2f3390e813..b255e2949af 100644
--- a/frontend/src/app/core/setup/globals/global-listeners/top-menu.ts
+++ b/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;