Skip to content

feat(editor): hide menu-bar items the editor can never run - #488

Merged
baseballyama merged 2 commits into
mainfrom
feat/editor-hide-unavailable-menu-items
Oct 28, 2026
Merged

baseballyama merged 2 commits into
mainfrom
feat/editor-hide-unavailable-menu-items

Conversation

@baseballyama

Copy link
Copy Markdown
Member

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: HIDDEN and HIDDEN_GROUPS list the items that are permanently unavailable, and isHidden also 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. The case branches and reason strings of hidden items are removed, along with their 25 Japanese translations, and so is the bullet flag that only Window ▸ document used.
  • core/menubar-visible.ts (new): pruneMenus drops 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, replacing withoutFeedback.
  • MenuBar.svelte renders visibleMenus(editor). Keyboard lookups (runMenuKey, menuKeyLeavesText, EditorApp, ArrangeMenu, and the in-menu key handler) still use the full nativeMenus(). 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.md describes 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. The UNSUPPORTED disabled-reason table is removed because both of its items are hidden.
  • Run locally and passing:
    • 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, visibleMenus and pruneMenus are internal (not exported from the package). The visible menus change, as described in the changeset (minor).

Checklist

  • I have read CLAUDE.md and followed the project's conventions.
  • I have added or updated tests for the change.
  • I have added or updated documentation where user-visible behavior changed.
  • If this is a breaking change, I have added a changeset / CHANGELOG entry and
    flagged it above.
  • I have re-read my own diff and removed dead code, debug prints, and stale
    comments.
  • If I used an LLM to draft this PR, I have verified each change myself, this
    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

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
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@baseballyama
baseballyama merged commit 1309cf4 into main Oct 28, 2026
14 checks passed
@baseballyama
baseballyama deleted the feat/editor-hide-unavailable-menu-items branch October 28, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants