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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix autofocus in the top menu
Benjamin Bädorf880a01293a9b
diff --git a/frontend/src/app/core/global_search/title/global-search-title.component.ts b/frontend/src/app/core/global_search/title/global-search-title.component.tsindex cdfb879c95e..f77c95bbf0f 100644--- a/frontend/src/app/core/global_search/title/global-search-title.component.ts+++ b/frontend/src/app/core/global_search/title/global-search-title.component.ts@@ -26,7 +26,12 @@// See COPYRIGHT and LICENSE files for more details.//++import {- ChangeDetectorRef, Component, ElementRef, Injector, Input, OnDestroy,+ ChangeDetectorRef,+ Component,+ ElementRef,+ Injector,+ Input,+ OnInit,} from '@angular/core';import { distinctUntilChanged } from 'rxjs/operators';import { combineLatest } from 'rxjs';@@ -42,7 +47,7 @@ export const globalSearchTitleSelector = 'global-search-title';selector: 'global-search-title',templateUrl: './global-search-title.component.html',})-export class GlobalSearchTitleComponent extends UntilDestroyedMixin implements OnDestroy {+export class GlobalSearchTitleComponent extends UntilDestroyedMixin implements OnInit {@Input() public searchTerm:string;@Input() public project:string;@@ -93,13 +98,10 @@ export class GlobalSearchTitleComponent extends UntilDestroyedMixin implements Oswitch (scope) {case 'all':return this.text.all_projects;- break;case 'current_project':return currentProjectName;- break;case '':return `${currentProjectName} ${this.text.project_and_subprojects}`;- break;default:return '';}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.tsindex 09c098233a6..b2f3390e813 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@@ -224,9 +224,10 @@ 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 whatsoeverfocusFirstInputOrLink(dropdown:JQuery) {- let toFocus = dropdown.find('ul :input:visible:first');- if (toFocus.length === 0) {- toFocus = dropdown.find('ul a:visible:first');+ 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]');+ const toFocus = focusable[0];+ if (!toFocus) {+ return;}// actually a simple focus should be enough.// The rest is only there to work around a rendering bug in webkit (as of Oct 2011),diff --git a/frontend/src/app/shared/components/autocompleter/project-menu-autocomplete/project-menu-autocomplete.template.html b/frontend/src/app/shared/components/autocompleter/project-menu-autocomplete/project-menu-autocomplete.template.htmlindex 32d7066ae57..6a613723afb 100644--- a/frontend/src/app/shared/components/autocompleter/project-menu-autocomplete/project-menu-autocomplete.template.html+++ b/frontend/src/app/shared/components/autocompleter/project-menu-autocomplete/project-menu-autocomplete.template.html@@ -1,14 +1,27 @@-<div class="dropdown dropdown-relative project-search-results" id="project_autocompletion_wrapper">+<div+ class="dropdown dropdown-relative project-search-results"+ id="project_autocompletion_wrapper"+><div class="project-menu-autocomplete--wrapper"><div class="project-menu-autocomplete--input-container">- <label for="project_autocompletion_input" class="hidden-for-sighted" [textContent]="text.label"></label>- <input type="text"- id="project_autocompletion_input"- name="project_autocompletion_input"- class="ui-autocomplete--input project-menu-autocomplete--input"- [attr.placeholder]="loadingText">+ <label+ for="project_autocompletion_input"+ class="hidden-for-sighted"+ [textContent]="text.label"+ ></label>+ <input+ type="text"+ id="project_autocompletion_input"+ name="project_autocompletion_input"+ class="ui-autocomplete--input project-menu-autocomplete--input"+ [attr.placeholder]="loadingText"+ /><i class="project-menu-autocomplete--search-icon icon-search"></i></div>- <p class="project-menu-autocomplete--no-results" hidden [textContent]="text.no_results"></p>+ <p+ class="project-menu-autocomplete--no-results"+ hidden+ [textContent]="text.no_results"+ ></p></div></div>