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

🐛 Textarea: Skru av autosize ved manuell resize #2518

Merged
merged 3 commits into from Nov 28, 2023
Merged

Conversation

HalvorHaugan
Copy link
Contributor

@HalvorHaugan HalvorHaugan commented Nov 27, 2023

#2506

Manuell resize overstyrer nå autosize, samt fjerner overflow:hidden slik at man får scrollbar ved behov.

Copy link

changeset-bot bot commented Nov 27, 2023

🦋 Changeset detected

Latest commit: 3311a47

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 Patch
@navikt/ds-css Patch
@navikt/aksel-stylelint Patch
@navikt/aksel Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/aksel-icons Patch

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

@HalvorHaugan HalvorHaugan marked this pull request as draft November 27, 2023 14:06
Copy link
Contributor

github-actions bot commented Nov 27, 2023

Storybook demo

Endringer til review: 1

e36974911 | 61 komponenter | 400 stories

if (inputRef.current?.style.height || inputRef.current?.style.width) {
// User has resized manually
if (inputRef.current?.style.overflow === "hidden") {
setState((oldState) => ({ ...oldState, overflow: false }));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dette er egentlig litt jalla. Jeg trenger egentlig bare å trigge en rerender, overflow kan bli satt tilbake til true rett etterpå uansett. Alternativt kan jeg gjøre inputRef.current.style.overflow = undefined her slik at rerender ikke er nødvendig.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Kan kanskje teste om inputRef.current.style.overflow = undefined fungerer bedre. Virker som en liten delay før scrollbar dukker opp nå, men er kanskje på grunn av debounce og ikke re-render 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Det er pga. debounce, ja. Tenkte det var unødvendig at handleResize kjørte så ofte ved resize, men kan godt fjerne debounce igjen der.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tror ikke noen vil merke det, så debounce fungerer fint 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kanskje ikke, men tror ikke det egentlig er nødvendig, og det ser mye smoothere ut når det ikke er forsinkelse.

@HalvorHaugan HalvorHaugan marked this pull request as ready for review November 27, 2023 15:13
@KenAJoh KenAJoh merged commit 8dda590 into main Nov 28, 2023
2 checks passed
@KenAJoh KenAJoh deleted the textarea-resizing branch November 28, 2023 11:30
@github-actions github-actions bot mentioned this pull request Nov 28, 2023
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.

None yet

2 participants