From f03fcb017f99a3e8d6ad52050e53c5fe5fc7d8f6 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Fri, 17 May 2019 12:31:56 -0700 Subject: [PATCH] LP1803787: Add keyboard support (Shift+F10) This allows a user to set focus to a row using a checkbox, then press the standard keyboard shortcut to open the row context menu. This commit sets the Shift+F10 keyboard combination to fire the contextmenu javascript event throughout the Angular staff client, so other interfaces that need to override the browser's context menu should be able to respond to Shift+F10. To test: 1) Open an eg2 grid interface (Server Administration -> Authority Thesaurus is a good one). 2) Use the tab key to set focus onto the checkbox for one of the rows. 3) Note that pressing Shift + F10 opens the browser's context menu. 4) Apply this commit 5) Repeat steps 1+2 6) Press Shift + F10. 7) Note that the context menu opens, and that you can use Tab and Shift+Tab to move through the various actions. 8) Note that you can press the Esc key to exit the context menu Signed-off-by: Jane Sandberg Signed-off-by: Bill Erickson --- .../app/share/grid/grid-body.component.html | 8 +++++++- .../eg2/src/app/staff/staff.component.html | 6 +++++- .../src/eg2/src/app/staff/staff.component.ts | 19 ++++++++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html index b83c619044..9ab26cd32e 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html @@ -14,7 +14,13 @@
- +
diff --git a/Open-ILS/src/eg2/src/app/staff/staff.component.html b/Open-ILS/src/eg2/src/app/staff/staff.component.html index 2a2539c067..7afcc325a6 100644 --- a/Open-ILS/src/eg2/src/app/staff/staff.component.html +++ b/Open-ILS/src/eg2/src/app/staff/staff.component.html @@ -13,7 +13,11 @@ keyDesc="Display AccessKey Info Dialog" i18n-keyDesc (click)="egAccessKeyInfo.open()"> + + - diff --git a/Open-ILS/src/eg2/src/app/staff/staff.component.ts b/Open-ILS/src/eg2/src/app/staff/staff.component.ts index 492b1df14d..dc58de1030 100644 --- a/Open-ILS/src/eg2/src/app/staff/staff.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/staff.component.ts @@ -62,8 +62,6 @@ export class StaffComponent implements OnInit { this.route.data.subscribe((data: {staffResolver: any}) => { // Data fetched via StaffResolver is available here. }); - - } /** @@ -108,6 +106,22 @@ export class StaffComponent implements OnInit { this.keys.fire(evt); } + /** + * Make sure to fire the contextmenu Event on Shift+F10 + */ + fireContextMenuEvent(): void { + let event = new MouseEvent("contextmenu", { + bubbles: true, + cancelable: false, + view: window, + button: 2, + buttons: 0, + }); + document.activeElement.dispatchEvent(event); + }; + + + /* @ViewChild('egAccessKeyInfo') private keyComponent: AccessKeyInfoComponent; @@ -115,4 +129,3 @@ export class StaffComponent implements OnInit { } - -- 2.43.2