ni / nimble

The NI Nimble Design System
https://nimble.ni.dev
MIT License
32 stars 8 forks source link

Investigate using pointer events for column resizing. #1362

Open atmgrifter00 opened 1 year ago

atmgrifter00 commented 1 year ago

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

atmgrifter00 commented 1 year ago

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

rajsite commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.