trussworks / react-uswds

USWDS 3.0 components built in React
https://trussworks.github.io/react-uswds/
Apache License 2.0
177 stars 80 forks source link

fix: moved smooth-scroll application to useEffect #2868

Closed werdnanoslen closed 4 months ago

werdnanoslen commented 4 months ago

Summary

Fixes leak of smooth-scroll, limits it just to pages where component is being used

Also changed a variable to be more descriptive

Related Issues or PRs

Resolves #2867

How To Test

Use storybook as an example, comparing the live version (where smooth-scroll is applied on all pages after loading the component) vs what you can build locally, shown below:

Apr-04-2024 14-31-50

Screenshots (optional)

github-actions[bot] commented 4 months ago
Warnings
:warning: This PR does not include changes to storybook, even though it affects component code.

Generated by :no_entry_sign: dangerJS against 62cfe93894b9a1bd90568e7637ebea9a26c70fd4

werdnanoslen commented 4 months ago

Looks good to me! I wonder if there would be value in including a test that checks for the class?

thanks, added