-
Notifications
You must be signed in to change notification settings - Fork 8
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
Investigate using pointer events for column resizing. #1362
Comments
Should try and handle the ability to cancel a column resize with the pointer event APIs (e.g. calling |
In specific a user signifying an intent (i.e. we listen for the esc key being pressed ourselves) and then relying on the pointer event api to handle that lifecycle easier (if esc is pressed and we have a captured pointer, release the captured pointer) |
There is an existing bug in Firefox related to pointer events where the click event will fire on whatever element the mouse is released over after doing a pointer capture. One example of a consequence here for the table (if we used pointer events), is that if a user drags a column divider and then releases it over a row (when row selection is enabled) that that row will be selected. The W3C working group has recently clarified what the standard behavior is for this scenario (see here and here). My feeling is that we should delay moving to pointer events until the Firefox issue is resolved. Attempting to use pointer events in concert with a workaround like the "glass overlay" yielded inconsistent behaviors across browsers. |
Ahh interesting, looks like Pointer Events was one of the topics for webcompat 2023: https://wpt.fyi/interop-2023 Edit: Well maybe, doesn't look like the pointer event focus areas would cover this case. Guess we will see maybe. |
Yeah, that's what I was noticing too. I was hoping that the bug in Firefox was linked from this area, but I don't believe it is. |
# Pull Request ## 🤨 Rationale The table columns can't be interactively resized using touch-based interfaces (mobile). Also fixes #1362 ## 👩💻 Implementation We handle dragging column dividers via the mouse events `mousedown`, `mousemove`, and `mouseup`. I replaced that with handling for the `pointerdown`, `pointermove`, and `pointerup` events. We also use `setPointerCapture` to force events to be handled by our divider, which allows us to remove the `glass-overlay` div. ## 🧪 Testing - Tested manually in local Storybook using Chrome's dev tools: works. - ... using Firefox dev tools: does not work. The issue is that the column dividers never appear, so they cannot be dragged. - Tested manually in Storybook on iPhone (Safari): works. - Updated unit tests ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
📌 User Story
The current implementation for column resizing uses the HTML mouse events for handling the resizing of a column. This has several drawbacks including:
Using the HTML pointer events seem like they can address all of the above issues without much effort.
The text was updated successfully, but these errors were encountered: