salesforce / salesforce/design-system-react

Explore tracking node focus with classname

Open
#1,509 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-clarity
Dominant language
JavaScript
Stars
982
Forks
440
Avg merge
1d 21h
Merged PRs (30d)
4

Description

Let's face it...writing a Mocha test that finds the node with the global focus of a document is a nightmare. PhantomJS intermittently fails and you have to restart TravisCI a few times a week due to unrelated tests that fail.

What if there was a classname...say .slds-focused or something like that which could be queried to find focus, then documentElement wouldn't have to be referenced. When the component controls focus (such as left and right arrows in a pill box), focus is set by the view-model itself on render anyway. When the user interacts with the UI (such as a mouse click), this is a different story however, since the DOM is setting focus itself and not the internal view-model, so this class would only be used by view-model-derived focus which would typically be what tests would test--we don't need to test if the browser works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or specific test path is named. Start by reviewing the Mocha focus tests and the existing focus handling for view-model-controlled components such as pill boxes, including the PhantomJS and TravisCI failures. Done requires an agreed focus-tracking approach that makes the relevant state queryable without relying on documentElement.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.