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

[css-overflow-3] [css-ui-4] Draggable scrollers #9811

Open
bramus opened this issue Jan 17, 2024 · 6 comments
Open

[css-overflow-3] [css-ui-4] Draggable scrollers #9811

bramus opened this issue Jan 17, 2024 · 6 comments
Labels
css-overflow-3 Current Work css-ui-4 Current Work

Comments

@bramus
Copy link
Contributor

bramus commented Jan 17, 2024

(Not sure which spec this should go into, ergo not tagging it)

Whenever I see demos like https://codepen.io/supah/pen/xxJMbbg I’m wondering what it would take to make a scroller draggable on desktop (i.e. click + hold on the scroller and then move the pointer to change the scroll offset)

Yes, it can be done with a tad of JS but that’s blocking and would require authors to try and recreate the native fling curves to get it right, often leading to an uncanny valley type of situation as that’s OS dependent.

Ideally, to me, it would be a single CSS property that says “this scroller can be dragged to scroll”. When activated, clicking + dragging on the padding-box of the scroller will change the scroll offset in response.

While this has some implications such as not being able to select text in those scrollers (I guess), I don’t think this is a problem for things like https://scroll-driven-animations.style/demos/cover-flow/css/. Authors should be educated to only use this feature in certain situations.

@Loirooriol Loirooriol added css-overflow-3 Current Work css-ui-4 Current Work labels Jan 17, 2024
@Loirooriol
Copy link
Contributor

No tag just makes it easier to forget about issues. Scrolling containers are CSS Overflow, and interaction with the pointer seems CSS UI, so going with that.

@bramus
Copy link
Contributor Author

bramus commented Jan 17, 2024

Thanks, Oriol. I’ve updated the title to reflect this as well.

@bramus bramus changed the title Draggable scrollers [css-overflow-3] [css-ui-4] Draggable scrollers Jan 17, 2024
@yisibl
Copy link
Contributor

yisibl commented Jan 19, 2024

Yes, this interaction effect is very popular: https://twitter.com/didiercatz/status/1744065302088843508

I have a hack implementation: https://twitter.com/yisibl/status/1744691885606945102

drag-tabs.mp4

@argyleink
Copy link
Contributor

What if the way this was implemented was with a "full scrollport covering, invisible, track and thumb". No code would have to change in the engine, because to it, the user is just dragging the thumb inside the track. To the user, they feel like theyre panning. As if scrollbar-width accepted 100cqb or 100cqi.

@yisibl
Copy link
Contributor

yisibl commented Jan 22, 2024

What if the way this was implemented was with a "full scrollport covering, invisible, track and thumb". No code would have to change in the engine, because to it, the user is just dragging the thumb inside the track. To the user, they feel like theyre panning. As if scrollbar-width accepted 100cqb or 100cqi.

This may result in the specified tab not being clicked.

@yisibl
Copy link
Contributor

yisibl commented Jan 22, 2024

@argyleink I achieved a similar effect using scroll-snap + scroll-timeline, and I'm not sure it can be improved any further.

https://codepen.io/yisi/pen/abMwRGL

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-overflow-3 Current Work css-ui-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants