Skip to content

feat(design): use colorIcon for Menu and Dropdown menu item icons - #1589

Merged
dengfuping merged 1 commit into
masterfrom
feat/menu-icon-color
Sep 24, 2026
Merged

dengfuping merged 1 commit into
masterfrom
feat/menu-icon-color

Conversation

@dengfuping

Copy link
Copy Markdown
Collaborator

📦 Modified package

  • @oceanbase/design
  • @oceanbase/ui
  • @oceanbase/icons
  • @oceanbase/charts
  • @oceanbase/util
  • @oceanbase/codemod
  • Other (about what?)

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

N/A

💡 Background and solution

Problem

Menu and Dropdown menu icons did not use the linear icon color. Neither antd nor OBUI sets a color for .ant-menu-item-icon / .ant-dropdown-menu-item-icon, so the icons inherited the item text color: Menu items use itemColor (gray9 #3b4a69), and the Dropdown popup menu sets color: colorText (gray10 #132039) on items and submenu titles. As a result the icons looked darker than the same icons in Button, Card and Table, which already use colorIcon (gray8 #5c6b8a).

Solution

  • Added a global rule for light menus — .ant-menu:not(.ant-menu-dark) — that sets colorIcon on the icons of items and submenu titles which are not selected, not danger and not disabled.
  • Added the same rule scoped to the Dropdown popup menu. The Dropdown menu is rendered with the ant-dropdown-menu prefix and its root does not carry the ant-menu class, so the Menu rule alone does not reach it.
  • Selected, danger and disabled items, plus dark and horizontal-selected cases, keep their own colors so state information is not lost.
  • Docs site: the first column of markdown tables used a hardcoded #595959; it now uses token.colorTextSecondary so the docs table follows the theme.
  • Added colocated tests for Menu and Dropdown: they assert the computed icon color equals the theme's colorIcon for light items and submenu titles, and that selected / danger / disabled / dark cases do not. Expected values are derived from the theme token (packages/design/src/theme/default.ts) instead of hardcoded RGB values, so the assertions stay in sync with the token definition.

Verified

  • npx vitest run --project @oceanbase/design → 64 test files, 406 tests passed.
  • npx eslint on the changed files → clean. npx tsc --noEmit -p packages/design/tsconfig.json reports no errors for the changed files.

📝 Changelog

Language Changelog
🇺🇸 English - Menu
  - 💄 In light theme, icons of menu items and submenu titles now use the linear icon color colorIcon (gray8 #5c6b8a), consistent with Button, Card and Table icons; selected, danger and disabled items keep their own colors.
- Dropdown
  - 💄 In light theme, icons of dropdown menu items and submenu titles now use the linear icon color colorIcon (gray8 #5c6b8a); selected, danger and disabled items keep their own colors.
🇨🇳 Chinese - Menu
  - 💄 亮色主题下,菜单项和子菜单标题的图标改用线性图标色 colorIcon(gray8 #5c6b8a),与 Button、Card、Table 的图标保持一致;选中、危险和禁用项保持原有状态色。
- Dropdown
  - 💄 亮色主题下,下拉菜单项和子菜单标题的图标改用线性图标色 colorIcon(gray8 #5c6b8a);选中、危险和禁用项保持原有状态色。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Tests is updated/provided or not needed
  • Changelog is provided or not needed

@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
oceanbase-design Ready Ready Preview Sep 24, 2026 3:00am UTC

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

😭 Preview Deploy failed.

@dengfuping
dengfuping merged commit 077dc3e into master Sep 24, 2026
9 checks passed

This branch was successfully deployed

1 active deployment
Preview — ef14f23e Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant