Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STCOM-1285 Migrate way from findDOMNode in stripes-react-hotkeys #44

Merged
merged 10 commits into from
Sep 25, 2024

Conversation

JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Aug 29, 2024

The way to migrate away from this deprecated fallback is to use a ref/supply a known DOM element.

HotKeys has always had the attach prop that accepts a ref to the scoped element.

If an element isn't provided, the findDOMNode will still be called and the error will be thrown.

If the element isn't provided, the Hotkeys component will redraw so that it can pass 'findDOMNode' through to FocusTrap.

This change removes the unavoidable call to findDOMNode within FocusTrap, depending on an element prop to be passed in from HotKeys.

Anticipated Migration:

<Hotkeys>
  <input />
</Hotkeys>

to

const inputRef = useRef(null);
<Hotkeys attach={inputRef}>
  <input ref={inputRef}/>
</Hotkeys>

Copy link

github-actions bot commented Aug 29, 2024

Bigtest Unit Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 76b0f15. ± Comparison against base commit 6b07821.

♻️ This comment has been updated with latest results.

Copy link
Member

@ncovercash ncovercash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea — let me know when it's ready for review!

lib/HotKeys.js Show resolved Hide resolved
Copy link

sonarcloud bot commented Sep 25, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@JohnC-80 JohnC-80 merged commit 63edbc7 into master Sep 25, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants