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

Transitions strip overflow-y and overflow-x inline style #15335

Open
fraser-0 opened this issue Feb 18, 2025 · 1 comment
Open

Transitions strip overflow-y and overflow-x inline style #15335

fraser-0 opened this issue Feb 18, 2025 · 1 comment

Comments

@fraser-0
Copy link

Describe the bug

If you explicitly set overflow-y and/or overflow-x as an inline style on an element that has a transition, they are removed on completion of the transition. However, if overflow is set it won't be removed.

I noticed this on the fly transition but from what Patrick mentioned in the Discord post it appears to affect all transitions.

Patrick noticed the transition code is only readingelement.style.overflow (which is empty when element.style.overflowY is set) here and sets it back to it at the end here.

Reproduction

I have created this playground to highlight the issue. You can replace the inline style element to overflow: auto to see it work fine.

Logs

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 556.67 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh

Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 8.15.0 - ~/Library/pnpm/pnpm
    bun: 1.1.12 - ~/.bun/bin/bun

Browsers:
    Chrome: 133.0.6943.55
    Edge: 131.0.2903.112
    Safari: 17.0

npmPackages:
    svelte: ^5.0.0-next.1 => 5.19.9

Severity

annoyance

@fraser-0 fraser-0 changed the title Transitions strips overflow-y and overflow-x inline style Transitions strip overflow-y and overflow-x inline style Feb 18, 2025
@adiguba
Copy link
Contributor

adiguba commented Feb 22, 2025

The problems seems to come from #14930, here :

/**
* The default overflow style, stashed so we can revert changes during the transition
* that are necessary to work around a Safari <18 bug
* TODO 6.0 remove this, if older versions of Safari have died out enough
*/
var overflow = element.style.overflow;

Then later :

So either we remove this if it is really not useful, or we fix it like this :

	var overflow = element.style.overflow;
+	var overflow_x = element.style.overflowX;
+	var overflow_y = element.style.overflowY;

Then :

-   element.style.overflow = overflow;
+  if (overflow_x === overflow_y) {
+    element.style.overflow = overflow;
+  } else {
+    element.style.overflowX = overflow_x;
+    element.style.overflowY = overflow_y;
+  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants