Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

(un)highlight on focusin and focusout #16

Closed
pkra opened this issue Sep 9, 2018 · 2 comments
Closed

(un)highlight on focusin and focusout #16

pkra opened this issue Sep 9, 2018 · 2 comments
Labels
enhancement/feature New feature or request
Milestone

Comments

@pkra
Copy link
Member

pkra commented Sep 9, 2018

Currently highlighting remains when the element loses focus.

IIRC it is intentional not to reset the aria-active-descendant (much like MathJax's a11y extensions), but I find the visual highlight disorienting.

It seems better UX to run unhighlight when focusout occurs and set run highlight again when focusin occurs.

@pkra pkra added the enhancement/feature New feature or request label Sep 9, 2018
@pkra
Copy link
Member Author

pkra commented Sep 29, 2018

Here's some simple code

  node.addEventListener('focusin',function(event){
    let navigator = chromify.navigators[event.target.id];
    chromify.highlight(navigator.active);
  });
  node.addEventListener('focusout',function(event){
    let navigator = chromify.navigators[event.target.id];
    chromify.unhighlight(navigator.active);
  });

@pkra
Copy link
Member Author

pkra commented Dec 4, 2018

For the new version:

 constructor(node, tree) {
    this.node = node;
    this.tree = tree;
    this.node.addEventListener('keydown', this.move.bind(this));
+   this.node.addEventListener('focusin', this.highlight.bind(this));
+   this.node.addEventListener('focusout', this.unhighlight.bind(this));
  }

@pkra pkra closed this as completed in 2e9561c Dec 12, 2018
@pkra pkra added this to the v2 milestone Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant