microbit-foundation / python-editor-v3

Micro:bit Educational Foundation Python Editor V3
https://python.microbit.org
MIT License
57 stars 36 forks source link

Use optional chaining to prevent button reference error. #997

Closed microbit-robert closed 2 years ago

microbit-robert commented 2 years ago

This is a logged bug that appears to occur after sending a gesture to the simulator and then expand/collapsing the accelerometer module panel. This causes a re-render and the gesture button ref can be undefined. We should also not change the focus if the user's last action was to expand/collapse the module, so this seems a reasonable fix.

github-actions[bot] commented 2 years ago

Preview build will be at https://review-python-editor-v3.microbit.org/sim-ref-issue/

microbit-matt-hillsdon commented 2 years ago

We can definitely merge this, but perhaps we shouldn't disable the button at all? E.g. a quick enter, tab is quite confusing. I'm assuming disabling the button is what's preventing focus staying on it. Feels like it needs some kind of reaction though.