Friday, April 20, 2018

Try to make a:focus behave differently between tabbing to an a tag and clicking on an a tag.

This suggests a way to do it by dragging in jQuery. Basically you have to swap a CSS effect in and out based on whether or not you just had a keydown or click event.

 
 

Addendum 4/23/2018: Remember that you should write logic to specifically make sure that the tab key was pressed and not some other key. The following example is of Angular 4 not jQuery like the Stack Overflow article.

keydownEvent(event: KeyboardEvent): void {
   if (event.keyCode === 9) {
      this.isToShowOutline = true;
   } else {
      this.isToShowOutline = false;
   }
}

No comments:

Post a Comment