Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions accessibility/keyboardui.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ const AreaManager = {
/* Overlay for gizmo buttons */
const GizmoMenuManager = {
overlay: null,
// Other menus (e.g. the add-shape dropdown) that should close themselves
// when the gizmo overlay opens, so they don't sit on top of the gizmos.
_closeHooks: [],
buttons: [
{ id: 'showShapesButton', label: '1' },
{ id: 'colorPickerButton', label: '2' },
Expand Down Expand Up @@ -241,9 +244,20 @@ const GizmoMenuManager = {
return !this.overlay.classList.contains('hidden');
},

registerCloseHook(fn) {
this._closeHooks.push(fn);
},

toggle(show) {
if (!this.overlay) return;
if (show) {
this._closeHooks.forEach((fn) => {
try {
fn();
} catch (e) {
console.error('GizmoMenuManager close hook failed:', e);
}
});
this.renderBadges();

if (this._watchFocus) {
Expand Down
10 changes: 10 additions & 0 deletions ui/addmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,16 @@ function cancelPlacement() {
cleanupPlacementMode();
}

// Close the add-shape dropdown when the gizmo overlay opens (e.g. Ctrl+G),
// so it doesn't sit on top of the gizmo buttons it's meant to reveal.
GizmoMenuManager.registerCloseHook(() => {
const dropdown = document.getElementById("shapes-dropdown");
if (!dropdown || dropdown.style.display === "none") return;
dropdown.style.display = "none";
removeKeyboardNavigation();
cancelPlacement();
});

// --- Keyboard Navigation ---

let currentFocusedElement = null;
Expand Down
Loading