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

Investigate using pointer events for column resizing. #1362

Closed
atmgrifter00 opened this issue Jul 19, 2023 · 5 comments · Fixed by #2435
Closed

Investigate using pointer events for column resizing. #1362

atmgrifter00 opened this issue Jul 19, 2023 · 5 comments · Fixed by #2435
Labels
blocked Blocked on a third-party issue tech debt

Comments

@atmgrifter00
Copy link
Contributor

📌 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:

  • not being touch-friendly
  • not properly dealing with cases where a users drags off-screen, does mouse clicks off-screen, and then moves the mouse back into the browser (without doing extra work).
  • necessitating an overlay in the template to intercept mouse events so other interactive elements don't see them while doing a column resize

Using the HTML pointer events seem like they can address all of the above issues without much effort.

@atmgrifter00
Copy link
Contributor Author

Should try and handle the ability to cancel a column resize with the pointer event APIs (e.g. calling releasePointerCapture).

@rajsite
Copy link
Member

rajsite commented Jul 19, 2023

Should try and handle the ability to cancel a column resize with the pointer event APIs (e.g. calling releasePointerCapture).

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)

@atmgrifter00
Copy link
Contributor Author

atmgrifter00 commented Jul 20, 2023

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.

@rajsite
Copy link
Member

rajsite commented Jul 20, 2023

Ahh interesting, looks like Pointer Events was one of the topics for webcompat 2023: https://wpt.fyi/interop-2023
Found that trying to see what the web platform test coverage looks like across browsers. Might explain the recent activity and hopefully those issues will be resolved soon! 🤞

Edit: Well maybe, doesn't look like the pointer event focus areas would cover this case. Guess we will see maybe.

@atmgrifter00
Copy link
Contributor Author

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.

@jattasNI jattasNI added the blocked Blocked on a third-party issue label Mar 18, 2024
m-akinc added a commit that referenced this issue Oct 16, 2024
# 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on a third-party issue tech debt
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants