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

Add bind:scrollWidth & bind:scrollHeight properties #13396

Open
nounder opened this issue Sep 25, 2024 · 2 comments
Open

Add bind:scrollWidth & bind:scrollHeight properties #13396

nounder opened this issue Sep 25, 2024 · 2 comments

Comments

@nounder
Copy link

nounder commented Sep 25, 2024

Describe the problem

Svelte has this wonderful feature that allows to create binding for {client,offset,content}{Width,Height} and other related properties. However, it does not support scroll{Width,Height}. Binding to those values would be useful for creating carousels, sliders, and other scroll-based components.

// dimensions
clientWidth: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
clientHeight: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
offsetWidth: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
offsetHeight: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
contentRect: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
contentBoxSize: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
borderBoxSize: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},
devicePixelContentBoxSize: {
omit_in_ssr: true,
invalid_elements: ['svelte:window', 'svelte:document']
},

Describe the proposed solution

Add bindings for scrollWidth and scrollHeight for all elements.

Importance

nice to have

@nounder
Copy link
Author

nounder commented Sep 25, 2024

This would require contents tracking of target element via MutationObserver or through other svelte means.

Any cues or no-gos? I'd like to implement this feature.

@nmzein
Copy link

nmzein commented Jan 29, 2025

Hey is anything stopping this being a thing? I've encountered multiple times where this would be useful and less boilerplate than an event listener. I can try to help get this implemenented if its okay with everyone.

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

No branches or pull requests

2 participants