Fix/overlay stale resize cursor - #1322
Merged
Merged
Conversation
Moving off a resizable overlay's edge attempted to clear the cursor by assigning `cursor: undefined` through `Object.assign(el.style, ...)`. The CSSOM ignores this as an invalid value, causing the resize cursor to remain on the element and continue showing over the window content. Remove the cursor from `customStyle` instead, then reset the element's inline cursor to the declared `style.cursor`, or clear it so class-based rules can apply again. Guard the reset so the DOM is only touched when a resize cursor was actually set.
Two resizable windows for checking the resize cursor by hand: one draggable, taking its base cursor from the CSS class, and one with an inline cursor in its style.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Hovering the edge of a resizable window switched the cursor to a resize cursor,
but moving back into the window left it there. The window kept showing a resize
cursor over its content until something else changed it.
Fix
The cursor is now removed when the pointer moves off the edge, falling back to
whatever the window declares: an inline
cursorfrom itsstyle, or the cursorfrom its CSS class.
The previous code assigned
undefined, which browsers ignore, so the resizecursor was never cleared.
Testing
Checked by hand in Litmus
(
litmus/features/window/resize-cursor.js) with a draggable + resizable windowand a resizable window with an inline cursor: hovering onto and off the edges,
resizing, and dragging. Type check and the test suite pass.