Repository navigation
feat(editor): hide menu-bar items the editor can never run - #488
Merged
Merged
Conversation
The menu bar listed every item of the reference desktop app's menus and disabled the ones without a counterpart (Print, Share, Macro, SmartArt, the online services, the Window menu …). Those items, the submenus left empty and the Window menu are now left out, and separators no longer double up. Items unavailable only in the current state stay disabled with their reason. Shortcuts still resolve against the full menus, so a hidden item's key does not reach the browser (⌘P does not print the page). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MNFNHqy4AXFo8fhuoSyzJp
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Clear Application Data and Check for Updates are now hidden with the other items the editor can never run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MNFNHqy4AXFo8fhuoSyzJp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The editor's menu bar stops showing items the editor can never run. It used to list every item of the reference desktop app's menus and disable roughly a hundred of them (Print, Share, Export, Macro, SmartArt, the online picture and translation services, the whole Window menu …), so users scanned past greyed-out rows to find the ones that work. Those items, the submenus left empty and the Window menu are now left out. Items that are unavailable only in the current state stay disabled, with the reason as their tooltip.
Motivation
Raised while embedding the editor in a product: the menus were mostly disabled entries with no way to enable them. No issue was filed.
Changes
ui/menubar-commands.ts:HIDDENandHIDDEN_GROUPSlist the items that are permanently unavailable, andisHiddenalso covers the chart types the library cannot insert. Only items that were already unconditionally disabled are listed. Context-dependent ones stay, for example Paste in the outline, Remove Section, Symbol outside text, Hyperlink, Custom Slide Show, and the slide-show items when the host cannot present. Thecasebranches and reason strings of hidden items are removed, along with their 25 Japanese translations, and so is thebulletflag that only Window ▸ document used.core/menubar-visible.ts(new):pruneMenusdrops hidden items, branches whose children were all hidden, and menus left empty. It also keeps separators from leading, trailing or doubling up. Help ▸ Feedback is now removed through it as well, replacingwithoutFeedback.MenuBar.svelterendersvisibleMenus(editor). Keyboard lookups (runMenuKey,menuKeyLeavesText,EditorApp,ArrangeMenu, and the in-menu key handler) still use the fullnativeMenus(). A hidden item's ⌘/⌃ shortcut is therefore still swallowed, as it was while disabled: ⌘P does not print the page and ⌘G does not trigger the browser's find.packages/dev/NATIVE_PARITY.mddescribes the trimmed menus.Testing
packages/editor/test/menubar-visible.test.mjs(new) covers separator cleanup, emptied submenus and menus, and a hidden menu.packages/dev/test/browser/menubar.test.mjs: the expected menus are the capture minus hidden items (21 menus and submenus instead of 33). The Window title is gone. The tooltip check uses Insert ▸ 記号/文字... instead of the now-hidden Thesaurus. TheUNSUPPORTEDdisabled-reason table is removed because both of its items are hidden.pnpm -r run build && cd packages/dev && node --test --test-concurrency=1 test/browser/menubar.test.mjs: 3 of 3 pass, including the keyboard-shortcut test (⌘G still does not group).cd packages/editor && node --test test/*.test.mjs: 285 pass.cd packages/dev && node --test test/*.test.mjs: 35 pass.pnpm -F @office-kit/pptx-editor typecheck: 0 errors.Breaking changes
None.
nativeMenus,visibleMenusandpruneMenusare internal (not exported from the package). The visible menus change, as described in the changeset (minor).Checklist
flagged it above.
comments.
PR represents real work that warrants a maintainer's review, and I am
willing to defend each line in review.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MNFNHqy4AXFo8fhuoSyzJp