-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] Prevent diagonal scrolling on iOS #11230
Comments
I think this could be extended to the desktop as well. When I'm scrolling say vertically, it often happens that the viewport will deviate slightly horizontally as I don't scroll perfectly straight. It would feel better if it didn't happen, not only for the UX but also because the horizontal scroll can trigger a column re-render and that can be very expensive if the user is scrolling vertically at the same time. The implementation would need to be really good, because otherwise it can make the grid very annoying to use. For example, in ag-grid the scroll-lock is kept active as long as the scroll hasn't completely stopped for maybe 0.75-1.0 seconds but the timer is extended even by user inputs that don't moved the viewport, so if I scroll vertically then directly switch to horizontal, I can keep inputing scroll gestures forever and it will not move the viewport until I stop for 1 second. That's obviously a very bad implementation. I think we should have the scroll-lock implement just a tiny bit of resistance. On possible implementation could be that the scroll-lock switches only when one of the |
@romgrk Do you mean on Windows? I can't reproduce it on macOS (desktop).
Agree. For me, macOS is great, it can be the target for mouse interactions. Android is great, it can be the target for touch interactions. On macOS (desktop), it feels like the implementation relies on:
On Android, it feels like the implementation relies on:
In these two, |
Yeah I'm on chrome linux, but usually it behaves the same as chrome windows. |
That would be awesome. It's impossible to scroll in straight line on iPhone. Furthermore, you may want to disable overscroll-behavior. Every time I visit mui-x on my iPhone, I think the virtualization is laggy/broken because of overscroll-behavior. Try scrolling up/down and pull a bit to the right (so that it overscrolls on the left-side), and you'll notice how next block of rows will display only after a visible delay, and at once. No issues on the desktop though. The experience is great on MacOS, and would be great not to have any artifical delays to the native behaviour there. |
Did this feature get implemented? I like to switch to MUI X for a project, but both the diagonal scroll and over scroll bounce are what are giving me pause at the moment. I would really like to use MUI X Premium (since I also need grouping) since otherwise MUI X is much faster and than what I am currently using. |
@lucare Out of curiosity, what are you using now that is too slow? As for this issue, I wouldn't expect this to be super hard to fix. For example, I had to solve problems like this in the past https://github.com/oliviertassinari/react-swipeable-views/blob/be57b7d9ba34c349a725b5ce9c0b265e0a9a9c18/packages/react-swipeable-views/src/SwipeableViews.js#L420-L440 or mui/material-ui#20990 (comment), I don't recall it was a big effort. Maybe this could be a cool item as part of the onboarding of @KenanYusuf in the team 😄 |
Famous last words 🙈. This seems to be an incredibly difficult problem to solve. Did a few explorations:
Haven't found any app that has solved it while keeping native scrolling for desktop and without using canvas. |
@lauri865 😂. I have seen some grid manipulating the scroll so much it was horrible. Thanks for the report on the exploration. Path 3 seemed to have potential, maybe it could solve #13551 too. Giving up on a sticky positioning, hum, yeah, hard UX tradeoff. For 4. and 5. this feels like a dead end. |
I don't think path 3 has any merit. The browser can lock the scroll for a full second before you can switch directions, plus giving up position sticky for this is a bad tradeoff imho. Then you get out of sync body and headers like Ag-grid has, and like Mui Datagrid used to have. My hack on path 5 is testable here (if you have a touch device at hand; has many rough edges, but the UX is still better than 3rd option would give us imho) (ref #16313): |
Setting |
Can't see the demo on my phone, but that was one of the first things I tested (forgot to mention). Problems:
I didn't see clear path to solve these, but if there is, it'd be great of course. Just wish there was a 'beforeScroll' event that'd enable manipulating scroll position before the frame is painted. Edit: |
Does fiddling with the if-check changes anything on iOS? The code I posted checks for |
I added a calculation for direction: Output: It only ever works in one direction, then it gets jammed. Does it work with Android? Or does Android have scroll railing built in? Edit: as long as there's offset in the opposite direction, the scroll is jammed and jumps back up or to the left a bit. If the offset clears, it works again. |
This is a continuation of the discussion that started at #10059 (comment) about the scrolling experience on mobile. The second comment about this: #10059 (comment).
I think that we all agree that the best UX on mobile is one where the scrolling direction is relatively well "fixed".
The test environment: https://next.mui.com/x/react-data-grid/#pro-plan.
You can find another example with https://docs.grid.glideapps.com/api/dataeditor/input-interaction#preventdiagonalscrolling. Implemented here. Related issue: glideapps/glide-data-grid#27.
On Android, the native scroll feels "right" ✅, it has a logic that locks the scroll in one direction once you are into it, but still lets you easily change the scroll direction with a large enough finger movement and without having to touch up and down. I don't think we should change it.
On iOS, the native scroll experience feels "broken" ❌, it's too hard to scroll vertically or horizontally without "drifting". We should fix that.
mui/material-ui#20990 is a bit related but a different problem, though it raises how
touch-action
could be part of the solution.Benchmarks
The text was updated successfully, but these errors were encountered: