I am working on a draggable element and I would like the cursor to change to grab
when hovering over it, and switch to grabbing
when the user clicks and holds the mouse down.
My current implementation closely follows the recommended approach in the top answer of this forum thread. However, I have encountered an issue where the cursor only changes to grabbing
once the mouse click is released (as mentioned in the thread's comments without a solution). Is there a way to update the cursor state while the mouse button is being held down?
Link to Minimum Reproducible Example
.outer-box {
height: 250px;
width: 250px;
border: 2px solid black;
cursor: grab;
}
.outer-box:active {
cursor: grabbing;
}
<div class="outer-box"></div>