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

♻️ Ny utility composeEventHandlers #2610

Merged
merged 16 commits into from
Jan 12, 2024
Merged

♻️ Ny utility composeEventHandlers #2610

merged 16 commits into from
Jan 12, 2024

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Jan 11, 2024

Description

Det oppstår ofte tilfeller der vi overskriver eventhandlers for komponenter. I de tilfellene kjører vi ofte props.onClick eller lignende. For å forenkle denne logikken og sikre at dette blir kjørt likt på tvers av systemet kan da composeEventHandlers tas i bruk;

Copy link

changeset-bot bot commented Jan 11, 2024

🦋 Changeset detected

Latest commit: eb049a3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@navikt/ds-react Minor
@navikt/ds-css Minor
@navikt/ds-tokens Minor
@navikt/ds-tailwind Minor
@navikt/aksel-icons Minor
@navikt/aksel Minor
@navikt/aksel-stylelint Minor

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

github-actions bot commented Jan 11, 2024

Storybook demo

Endringer til review: 1

7c2d02b8c | 61 komponenter | 401 stories

@KenAJoh KenAJoh changed the title 💄 Synket prettier ♻️ Ny utility composeEventHandlers Jan 11, 2024
@navikt/core/react/src/util/composeEventHandlers.ts Outdated Show resolved Hide resolved
@navikt/core/react/src/modal/Modal.tsx Show resolved Hide resolved
@navikt/core/react/src/modal/Modal.tsx Outdated Show resolved Hide resolved
Comment on lines 15 to 19
if (
checkForDefaultPrevented === false ||
!(event as unknown as Event).defaultPrevented
) {
return ourEventHandler?.(event);
Copy link
Contributor

Choose a reason for hiding this comment

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

Det at vi nå lytter til defaultPrevented flere steder kan vel i teorien brekke ting...? Men det å gjøre preventDefault() har vel ikke hatt noen effekt tidligere, så det er vel usannsynlig at folk har gjort det? (Ble mye "vel" her 😅)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ja endringen har potensiale for å kunne brekke noe, selv om det vil være edgecaser 🤔 Er med på å stashe denne på en v6-branch hvis vi ikke ønsker å risikere det som en minor-versjon

HalvorHaugan
HalvorHaugan previously approved these changes Jan 12, 2024
@KenAJoh KenAJoh merged commit f707b22 into main Jan 12, 2024
2 checks passed
@KenAJoh KenAJoh deleted the prettyfy-again branch January 12, 2024 19:32
@github-actions github-actions bot mentioned this pull request Jan 12, 2024
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