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

[aksel.nav.no] Make inert-prop in ShowMore work in React 19 #3497

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

HalvorHaugan
Copy link
Contributor

Found this bug when working on Pensjonskalkulator, since they have a copy of this component there. They have just migrated to React 19, which turns out now supports inert and now "translates" empty string to false. So correct value in React 19 is true.

Copy link

changeset-bot bot commented Jan 9, 2025

⚠️ No Changeset found

Latest commit: 8ef4c24

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -96,6 +96,8 @@ export const ShowMore =

const ChevronIcon = isOpen ? ChevronUpIcon : ChevronDownIcon;

const inertValue = parseInt(version.split(".")[0]) > 18 ? true : ""; // Support for inert was added in React 19
Copy link
Contributor Author

@HalvorHaugan HalvorHaugan Jan 9, 2025

Choose a reason for hiding this comment

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

We could have just hard coded it according to what React version we are using on the website, but I made it dynamic in case we decide to release this as a component in the React package later.

@HalvorHaugan HalvorHaugan merged commit dd642d7 into main Jan 10, 2025
4 checks passed
@HalvorHaugan HalvorHaugan deleted the showmore-inert branch January 10, 2025 13:55
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.

2 participants