Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Ability to resize lists on mobile
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
seriously all this one needs is to add an ontouch sensor, and it should be fixed, and the list system already has onmousePreferably it's changed to a pointerdown, because pointerdown recognizes basically everything, while click and touch event handlers only reconize computer mice and touchscreen inputs- while things like pointerdown also recognizes styluses and other forms of input.
Besides, it takes up less space in code.
Also, I think I found the exact two lines of code that are causing the problem:
https://github.com/scratchfoundation/scratch-gui/blob/develop/src/containers/list-monitor.jsx#L140
(lines 140-152)
const onMouseUp = ev => { //Note inserted by the post author (@BigNate469): The following function is declared further up in this file, it basically just looks for where the mouse is and sets the width and height accordingly. onMouseMove(ev); // Make sure width/height are up-to-date window.removeEventListener('mousemove', onMouseMove); window.removeEventListener('mouseup', onMouseUp); this.props.vm.runtime.requestUpdateMonitor(Map({ id: this.props.id, height: this.state.height, width: this.state.width })); }; window.addEventListener('mousemove', onMouseMove); window.addEventListener('mouseup', onMouseUp);
Unfortunately, I don't presently have the time to fork and edit scratch-gui to see if this actually is.
Edit: after building it, changing the above to pointer events doesn't seem to work, at least on my Chromebook (which has a touchscreen). See below post
||
v
Last edited by BigNate469 (Jan. 31, 2025 17:38:59)
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
Okay, I did manage to get it working. Code that needs to be changed:
src/components/monitor/list-monitor.jsx line 142, src/components/monitor/list-monitor.jsx line 143, src/components/monitor/list-monitor.jsx line 151,src/components/monitor/list-monitor.jsx line 152, and src/components/monitor/list-monitor.jsx line 47.
Basically, changing everywhere it says “mousedown”, “mouseup” and “onMouseDown” to “pointerdown”, “pointerup” and “onPointerDown” respectively seems to make resizing lists work on both touchscreens and computer mice/trackpads, although I've only been able to test it on my Chromebook's built-in trackpad (I don't have a mouse on me right now), and my Chromebook's touchscreen.
Diff:
src/components/monitor/list-monitor.jsx (line 47):
src/containers/list-monitor.jsx (lines 140-152):
Note that this doesn't change the fact that the equals sign is hard to tap on mobile anyways, but it at least fixes the fundamental problems with the event listeners involved.
src/components/monitor/list-monitor.jsx line 142, src/components/monitor/list-monitor.jsx line 143, src/components/monitor/list-monitor.jsx line 151,src/components/monitor/list-monitor.jsx line 152, and src/components/monitor/list-monitor.jsx line 47.
Basically, changing everywhere it says “mousedown”, “mouseup” and “onMouseDown” to “pointerdown”, “pointerup” and “onPointerDown” respectively seems to make resizing lists work on both touchscreens and computer mice/trackpads, although I've only been able to test it on my Chromebook's built-in trackpad (I don't have a mouse on me right now), and my Chromebook's touchscreen.
Diff:
src/components/monitor/list-monitor.jsx (line 47):
- onMouseDown={draggable ? onResizeMouseDown : null} + onPointerDown={draggable ? onResizeMouseDown : null}
src/containers/list-monitor.jsx (lines 140-152):
const onMouseUp = ev => {
onMouseMove(ev); // Make sure width/height are up-to-date
- window.removeEventListener('mousemove', onMouseMove);
- window.removeEventListener('mouseup', onMouseUp);
+ window.removeEventListener('pointermove', onMouseMove);
+ window.removeEventListener('pointerup', onMouseUp);
this.props.vm.runtime.requestUpdateMonitor(Map({
id: this.props.id,
height: this.state.height,
width: this.state.width
}));
};
- window.addEventListener('mousemove', onMouseMove);
- window.addEventListener('mouseup', onMouseUp);
+ window.addEventListener('pointermove', onMouseMove);
+ window.addEventListener('pointerup', onMouseUp);
Note that this doesn't change the fact that the equals sign is hard to tap on mobile anyways, but it at least fixes the fundamental problems with the event listeners involved.
Last edited by BigNate469 (Jan. 31, 2025 19:03:59)
- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
-snip-It’s possible to use the stackexchange touch to mouse too, as I do, though fixing the glitch is way easier for everyone (maybe it could be dine during maintenance ?)
Last edited by Catzcute4 (Jan. 31, 2025 22:48:09)
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
There are issues with your solution though:-snip-It’s possible to use the stackexchange touch to mouse too, as I do, though fixing the glitch is way easier for everyone (maybe it could be dine during maintenance ?)
1. Once enabled, it breaks if the user then uses a mouse without reloading the page
2. According to your post, it breaks Scratch in the process (which is obviously not a good thing)
3. Scratch's source code is not directly run in a browser- in fact, it's incapable of doing so. It has to be built first, and it's possible that whatever React component they stick that code into might not be able to affect the list monitor anyways
4. It doesn't fix the underlying problem, it just treats the symptoms.
5. It's substantially longer than mine

- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
indeed. that’s why i support your idea of just fixing it. also don’t forget about the slider variables whose limits cannot changeThere are issues with your solution though:-snip-It’s possible to use the stackexchange touch to mouse too, as I do, though fixing the glitch is way easier for everyone (maybe it could be dine during maintenance ?)
1. Once enabled, it breaks if the user then uses a mouse without reloading the page
2. According to your post, it breaks Scratch in the process (which is obviously not a good thing)
3. Scratch's source code is not directly run in a browser- in fact, it's incapable of doing so. It has to be built first, and it's possible that whatever React component they stick that code into might not be able to affect the list monitor anyways
4. It doesn't fix the underlying problem, it just treats the symptoms.
5. It's substantially longer than mine
Last edited by Catzcute4 (Feb. 2, 2025 21:51:51)
- 50_scratch_tabs
-
Scratcher
1000+ posts
Ability to resize lists on mobile
(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
Try changing a slider variable to anything on mobile. You will find that no matter how long you press and hold on the variable monitor, the dialog to change it to another type of variable or change its range never pops up.(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
- 50_scratch_tabs
-
Scratcher
1000+ posts
Ability to resize lists on mobile
(#247)Oh, sorry. I could've sworn I did that before. Also, @BigNate469, if you have a GitHub account you could make a pull request.Try changing a slider variable to anything on mobile. You will find that no matter how long you press and hold on the variable monitor, the dialog to change it to another type of variable or change its range never pops up.(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
he probably has(#247)Oh, sorry. I could've sworn I did that before. Also, @BigNate469, if you have a GitHub account you could make a pull request.Try changing a slider variable to anything on mobile. You will find that no matter how long you press and hold on the variable monitor, the dialog to change it to another type of variable or change its range never pops up.(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
- 50_scratch_tabs
-
Scratcher
1000+ posts
Ability to resize lists on mobile
(#248)It doesn't look like he has. May I?(#247)Oh, sorry. I could've sworn I did that before. Also, @BigNate469, if you have a GitHub account you could make a pull request.Try changing a slider variable to anything on mobile. You will find that no matter how long you press and hold on the variable monitor, the dialog to change it to another type of variable or change its range never pops up.(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
And as for the slider thing, this seems to be intentional: https://github.com/scratchfoundation/scratch-gui/blob/4416bb5f6d2b19b4d923cb6bc64a598725ce6e60/src/components/monitor/monitor.jsx#L46
- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
I don’ think mobile accessibility problems would be intentional.(#248)It doesn't look like he has. May I?(#247)Oh, sorry. I could've sworn I did that before. Also, @BigNate469, if you have a GitHub account you could make a pull request.Try changing a slider variable to anything on mobile. You will find that no matter how long you press and hold on the variable monitor, the dialog to change it to another type of variable or change its range never pops up.(#245)I don't believe this is true.
also don’t forget about the slider variables whose limits cannot change
And as for the slider thing, this seems to be intentional: https://github.com/scratchfoundation/scratch-gui/blob/4416bb5f6d2b19b4d923cb6bc64a598725ce6e60/src/components/monitor/monitor.jsx#L46
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
I do (same username- github.com/BigNate469), I just haven't gotten to making a PR. Go ahead and do so if you wish.snipIt doesn't look like he has. May I?
- 50_scratch_tabs
-
Scratcher
1000+ posts
Ability to resize lists on mobile
(#251)It's not mobile accessibility, it's that they don't want long pressing to happen when you're dragging sliders.
I don’ think mobile accessibility problems would be intentional.
(#252)I made an issue, which you're supposed to do (among other things) before making a PR.
I do (same username- github.com/BigNate469), I just haven't gotten to making a PR. Go ahead and do so if you wish.
- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
if mouse y > [the html slider’s y coordinate] + [offset if the css does things like putting 0 0 at top left] then do it (mouse y btw is something accessible via event listeners(#254)I haven't worked with scratch-gui quite enough to know how to do that.well like just have it on the top portion(#251)It's not mobile accessibility, it's that they don't want long pressing to happen when you're dragging sliders.
I don’ think mobile accessibility problems would be intentional.
Last edited by Catzcute4 (Feb. 4, 2025 13:42:40)
- TeacherZooetrope
-
Scratcher
93 posts
Ability to resize lists on mobile
Scratch supports Android. Sometimes, mobile have small screens so they have less space for their screen. Have any laptop of that?
- OGBoneK
-
Scratcher
9 posts
Ability to resize lists on mobile
(#256)That sounds really hacky and error prone.
if mouse y > + hen do it (mouse y btw is something accessible via event listeners
(#257)What?
Scratch supports Android. Sometimes, mobile have small screens so they have less space for their screen. Have any laptop of that?![]()
(Geez, soon my alts are gonna have more posts than my main!)
Last edited by OGBoneK (Feb. 4, 2025 12:09:36)
- BigNate469
-
Scratcher
1000+ posts
Ability to resize lists on mobile
It isn't really “hacky”, although it is error prone- especially if the slider variable is at the bottom of the screen.(#256)That sounds really hacky and error prone.
if mouse y > + hen do it (mouse y btw is something accessible via event listeners
if mouse y > [the html slider’s y coordinate] + [offset if the css does things like putting 0 0 at top left] then do it (mouse y btw is something accessible via event listeners(edited quote to make it appear correctly)
- Catzcute4
-
Scratcher
500+ posts
Ability to resize lists on mobile
OMG thanks for teaching me thatif mouse y > [the html slider’s y coordinate] + [offset if the css does things like putting 0 0 at top left] then do it (mouse y btw is something accessible via event listeners
Last edited by Catzcute4 (Feb. 4, 2025 13:44:03)