Skip to content

Commit

Permalink
Enhance highlight directive to blur on keypress for improved accessib…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
robsonalvesdev committed Nov 28, 2024
1 parent dcdf1d6 commit e741949
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/directives/highlight.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export class HighlightDirective {
private highlight(color: string, visibility: boolean = true) {
if (visibility) {
this.el.nativeElement.classList.add(color);
this.el.nativeElement.blur();
this.el.nativeElement.addEventListener('keypress', () => { this.el.nativeElement.blur(); window.focus(); });
} else {
this.el.nativeElement.classList.remove(color);
this.el.nativeElement.blur();
this.el.nativeElement.addEventListener('keypress', () => { this.el.nativeElement.blur(); window.focus(); });
}
}
}

0 comments on commit e741949

Please sign in to comment.