Open DNin01 opened 2 years ago
Some additional information: I noticed while investigating this that if the input focus is in a text field, for example if you're editing the text in a "think" block, then the alt-left key combo causes the browser to go back as expected.
Aha! This is the culprit:
https://github.com/scratchfoundation/scratch-gui/blob/0bd773871998e5df34ff0b32c8cd026c57d401a0/src/lib/vm-listener-hoc.jsx#L97-L100
e.preventDefault()
was probably used here to stop the arrow keys or space bar from scrolling the page, but it also prevents it from activating the back/forward keyboard shortcuts. All we should need to do is add && !e.altKey
, and maybe some other modifier keys to fix other potential keyboard shortcuts.
Expected Behavior
Alt+Left is a browser keyboard shortcut that takes you back to the previous page, just like the Back button.
Actual Behavior
You can't do that. Probably due to the browser believing that it's already doing something on the webpage, so it doesn't go back.
Steps to Reproduce
Nothing happens, other than the project recognizing that you pressed the left arrow key.
System Details/Other
Windows 10 with Edge 101.0.4951.64
This glitch was also reported on Scratch over at https://scratch.mit.edu/discuss/topic/406748/
Luckily, on Chrome or Edge anyways, if you press Alt, then Alt+Left, it focuses the three dots button on the menu bar and then you can go back.
Originally reported on https://github.com/LLK/scratch-www/issues/6878, but that was in the wrong repository AFAIK