Skip to content

Commit

Permalink
Workaround for incorrectly triggered hover state when dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
Inwerpsel committed May 20, 2024
1 parent ea2ca5f commit 65d1758
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
40 changes: 20 additions & 20 deletions docs/demo/dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/demo/dist/bundle.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/demo/dist/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/demo/dist/main.css.map

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/css/movable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ $subtle-grey: rgb(179, 162, 162);
> :hover {
border-color: black;
}

// Workaround for browser bug when starting a drag and ending up
// above another element. The current behavior in Chromium is definitely wrong:
// We can only arrive above the element after already having initiated the drag.
// Which should have made it ignore the cursor for normal mouse events outside of
// the in progress drag. Nevertheless this is what Chromium does.
// => drag has started
// => capture drag image of picked up element before changing its appearance
// => modify the height of picked up element
// => cursor still triggers hover state of next element, but drag image is correct
// This false hovered state stays present until you drop the dragged element,
// making a random element look different for no reason, very confusing.
.is-dragging & > :hover {
border-color: transparent;
}
}

$area-speed: .2s;
Expand Down

0 comments on commit 65d1758

Please sign in to comment.