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

[DataGrid] Add support for Column resizing on mobile #416

Closed
2 tasks done
oliviertassinari opened this issue Oct 8, 2020 · 1 comment · Fixed by #537
Closed
2 tasks done

[DataGrid] Add support for Column resizing on mobile #416

oliviertassinari opened this issue Oct 8, 2020 · 1 comment · Fixed by #537
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@oliviertassinari
Copy link
Member

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The column resizing isn't working with a touch pointer. Most frequently, touch pointers can be found on mobile devices but that's not the only place. They can be found too on desktop, e.g. Windows Surface.

Expected Behavior 🤔

Column resizing works with a touch pointer.

Steps to Reproduce 🕹

Steps:

  1. Open https://material-ui.com/components/data-grid/columns/#column-resizing
  2. Try to resize

Context 🔦

Resizing is implemented with a mouse move handler.

https://github.com/mui-org/material-ui-x/blob/05ccbe31f6c5954e50399262f1afffe52006aca0/packages/grid/_modules_/grid/hooks/features/useColumnResize.tsx#L44

However, with the latest browser proposal: mui/material-ui#22814, we can drop all the mouse and touch handlers, replacing them with the PointerEvent API. Browser support: https://caniuse.com/mdn-api_pointerevent.

Your Environment 🌎

Tech Version
Material-UI X v4.0.0-alpha.6
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! labels Oct 8, 2020
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Oct 15, 2020

It seems that PointerEvent is a dead-end since we will keep supporting Safari 12: mui/material-ui#23068. So we can move forward with the touch start, as we did in the slider: https://github.com/mui-org/material-ui/blob/0d0e370c6e783f967fbd922ac925f576bee2b9ae/packages/material-ui/src/Slider/Slider.js#L675.

If you want another source to benchmark: https://github.com/tannerlinsley/react-table/blob/master/src/plugin-hooks/useResizeColumns.js but I think that a copy & paste of the slider's logic would be better. We went through a bunch of iterations on it, it's battle-tested and almost all reported bugs were solved (see the open issue to learn more).

@DanailH DanailH self-assigned this Oct 29, 2020
@oliviertassinari oliviertassinari added new feature New feature or request and removed bug 🐛 Something doesn't work labels Nov 2, 2020
@oliviertassinari oliviertassinari changed the title [DataGrid] Column resizing is not working with touch [DataGrid] Add support for Column resizing on moble Nov 2, 2020
@oliviertassinari oliviertassinari changed the title [DataGrid] Add support for Column resizing on moble [DataGrid] Add support for Column resizing on mobile Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants