Use single openMenu state for RepoToolbar menus #54
Loading…
Reference in a new issue
No description provided.
Delete branch "UI_UX"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This change refactors
src/lib/RepoToolbar.svelteto replace the two boolean menu states (historyOpen,syncOpen) with a single union-typedopenMenu: "history" | "sync" | null. Event handlers, conditionals and attributes were updated so menu visibility is driven from that single state.Key behavior and implementation changes
let historyOpen = false; let syncOpen = false;withlet openMenu: "history" | "sync" | null = null;.openMenuto the corresponding string or tonullto close (e.g.openMenu = openMenu === "sync" ? null : "sync").{:if openMenu === "sync"}/{:if openMenu === "history"}.openMenu = nullbefore calling callbacks (onFetchPrune,onForcePush,onSyncOptions,onOpenLfs, etc.).openMenu:openMenu = null.openMenu = nullwhen any menu is open.aria-expandedandclass:activebindings were switched to checkopenMenu === "..."to keep accessibility state and styling consistent.Summary
The visible outcome is unchanged UI behavior but with a single source of truth for which toolbar menu is open. At runtime only one menu can be open at a time; clicking outside or pressing Escape closes the open menu. There are no changes to public props or callback signatures.
Testing
No test execution results were provided.
Recommended quick checks for the reviewer
aria-expandedon each trigger reflects the menu state (truewhen that menu is open, otherwise absent/false).historyOpenorsyncOpento ensure no references were left behind.Compatibility / Risks
historyOpen/syncOpen(unlikely since they were internal). Also verify keyboard and screen-reader behavior remains correct after the binding changes.Reviewer action
src/lib/RepoToolbar.sveltefor any missed references or regressions in accessibility attributes and ensure the suggested checks pass in the running app.Consolidates the previous historyOpen and syncOpen booleans into a single union-typed openMenu ("history" | "sync" | null). Menu toggles, outside-click handler, Escape key handling and menu-item clicks now set/clear openMenu, and aria-expanded / class bindings were updated to reference openMenu. No user-facing behavior changes intended beyond ensuring only one menu can be open at a time and simplifying the event-handling logic.