-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
We've been testing the widget/dropdown div changes from #9213 and #9216 and unfortunately we think there is too much breakage in MakeCode without a clear route to address for Friday's release.
Please can you revert the widget div PR and consider carefully whether to also revert the dropdown div PR? We lean towards reverting both and reconsidering the approach.
This will reinstate focus quirks for mixed mode scenarios where you click outside the workspace when a field edit is in progress and then tab back into the toolbox/workspace. Clicking on the workspace or in MakeCode, using Cmd+B, 4 will fix it. We prefer a mixed mode bug with a workaround to a core keyboard nav flow bug.
Problems in blockly-samples field slider
Mainly just to illustrate it's not entirely a MakeCode thing and may affect others.
- Drag out e.g. this block
- Click to edit the field
- Click in the number input
- Enter to confirm
Note that the block is not selected when it normally would be. This is because focus was returned when you clicked outside the dropdown even though a widget was still open.
This is caused by #9213
You can see the problem more clearly by adding the keyboard nav plugin to the test page and using keyboard interactions except step 3.
Problems in MakeCode
They are essentially the same but more prominent and with significant impact on the keyboard navigation feature. We have several field editors which augment number field with a dropdown part to implement a combobox experience or an associated slider similar to field-slider but where the input can also be interacted with.
For keyboard navigation we use up/down to move between these two parts which works well.
But now moving away from the widget part removes the widget part entirely leaving a stranded dropdown. The user experience is that they cannot move back up to the widget.
If the user does use escape to close the dropdown part that they're stuck in then focus is not correctly returned and we end up with passive focus on the field.
This is caused by #9216 (because it's the widget taking ephemeral focus).
Example: combo box
Screen.Recording.2025-07-09.at.15.08.22.mov
Example: slider
Screen.Recording.2025-07-09.at.15.09.42.mov
Potential solutions
We've tried showing the widget part with autoCloseOnFocusLost false:
- this means the widget doesn't close which reinstates the ability to move back and forth
- pressing enter in the dropdown part still results in passive focus on the field
- the dropdown part no longer closes when clicking outside the workspace, with no clear route to fix
- we can call DropDownDiv.hide() but that focuses the workspace
- this might not always be an easy change to make to a field
Trying to manage focus ourselves using the focus manager led to largely the same problems.
Prior to the above PRs, calling hideChaff at the right point was a workaround we were considering. It doesn't seem to have these issues but it's a pain to decide when to do it as we have to allow focus moving between workspace/widget and dropdown divs and only hideChaff when moving outside them as a group. We think this solution can't help us with the above PRs in place, but it could be an alternative, perhaps in MakeCode as a follow-up to the release ahead of another solution in Blockly.
Otherwise I think a careful rethink of the right API to offer such fields is needed, particularly when they pair fields like number with a dropdown div.