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

Restore dev functionality of keyboard handling

Oliver Günther438b87a56aa6
diff --git a/frontend/src/app/shared/directives/a11y/keyboard-shortcut.service.ts b/frontend/src/app/shared/directives/a11y/keyboard-shortcut.service.ts
index ca66b79b130..55febeb48b8 100644
--- a/frontend/src/app/shared/directives/a11y/keyboard-shortcut.service.ts
+++ b/frontend/src/app/shared/directives/a11y/keyboard-shortcut.service.ts
@@ -137,35 +137,19 @@ export class KeyboardShortcutService {
window.open(this.PathHelper.keyboardShortcutsHelpPath());
}
- // eslint-disable-next-line class-methods-use-this
- findListInPage():HTMLElement[] {
- const domLists = jQuery(accessibleListSelector);
- const focusElements:HTMLElement[] = [];
- domLists.find('tbody tr').each((index, tr) => {
- const firstLink = jQuery(tr).find(':visible:tabbable')[0];
- if (firstLink !== undefined) {
- focusElements.push(firstLink);
- }
- });
- return focusElements;
- }
-
focusItemOffset(offset:number):void {
- const list = this.findListInPage();
-
- if (list === null) {
+ const list = document.querySelector(accessibleListSelector);
+ if (!list) {
return;
}
- const index = list.indexOf(
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- jQuery(document.activeElement!)
- .closest(accessibleRowSelector)
- .find(':visible:tabbable')[0] as HTMLElement,
- );
-
- const target = jQuery(list[(index + offset + list.length) % list.length]);
- target.focus();
+ const rows:HTMLElement[] = Array.from(list.querySelectorAll('tbody > tr'));
+ let index:number;
+ if (document.activeElement) {
+ index = rows.indexOf(document.activeElement);
+ const target = rows[index + offset];
+ target?.focus();
+ }
}
focusNextItem():void {