Skip to content
Snippets Groups Projects
Commit b410845e authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

Added a check that we're not within an input nor textarea

parent 3e795ffe
No related branches found
No related tags found
2 merge requests!884feat(a11y): Add anchor to access main interactive components,!883feat(a11y): Set starting focus to progress bar in orientation
......@@ -30,6 +30,14 @@ export class AppComponent implements OnInit {
// Listener, keyboard shortcuts
@HostListener('window:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent): void {
const target = event.target as HTMLElement;
const tagName = target.tagName.toLowerCase();
// Check if the focus is within an input, textarea
if (['input', 'textarea'].includes(tagName) || target.isContentEditable) {
return;
}
switch (event.key) {
case 'h': // 'h' to go to the header (resin logo)
this.headerComponent.focusLogo();
......
......@@ -122,6 +122,14 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
// Listener, keyboard shortcuts
@HostListener('window:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent): void {
const target = event.target as HTMLElement;
const tagName = target.tagName.toLowerCase();
// Check if the focus is within an input, textarea
if (['input', 'textarea'].includes(tagName) || target.isContentEditable) {
return;
}
switch (event.key) {
case 'f': // 'f' to go to the navigation footer
this.navComponent.focusFirstButton();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment