fix(list-monitor): wire touch events to resize handle#10066
Open
Chessing234 wants to merge 1 commit intoscratchfoundation:developfrom
Open
fix(list-monitor): wire touch events to resize handle#10066Chessing234 wants to merge 1 commit intoscratchfoundation:developfrom
Chessing234 wants to merge 1 commit intoscratchfoundation:developfrom
Conversation
The resize handle registered onMouseDown / mousemove / mouseup only, so drag-to-resize was completely non-functional on touchscreens. getEventXY (already imported from touch-utils and used inside handleResizeMouseDown) normalises both mouse and touch coordinates, so no extra extraction logic is needed — the events just needed to be registered. Adds onTouchStart to the JSX resize div and registers touchmove / touchend alongside their mouse equivalents, with symmetric cleanup in onMouseUp. Fixes scratchfoundation#9821.
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
Bug
List monitors cannot be resized on touchscreen devices. The resize handle (
=) registers onlyonMouseDown/mousemove/mouseup, so dragging on a phone or tablet has no effect.Fixes #9821.
Root cause
handleResizeMouseDowninsrc/containers/list-monitor.jsxalready usesgetEventXYfromsrc/lib/touch-utils, which normalises bothMouseEventandTouchEventcoordinates. The logic is touch-aware; the events were simply never registered.src/components/monitor/list-monitor.jsxpassesonResizeMouseDowntoonMouseDownonly — there is noonTouchStartbinding on the resize<div>.Fix
Two files, five lines added:
src/components/monitor/list-monitor.jsx— addonTouchStartalongsideonMouseDownon the resize div so the handler fires on touch devices.src/containers/list-monitor.jsx— registertouchmove/touchendalongsidemousemove/mouseupwhen the drag starts, and remove them symmetrically in the cleanup closure.No coordinate-extraction changes are needed because
getEventXYalready handles both event types.