fix: support submenu item title#868
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for a custom title property on submenus (SubMenuType), allowing users to specify a native HTML title attribute for submenus without overriding the display label. This is achieved by introducing an itemTitle prop to SubMenuProps and resolving it in the DOM element's title attribute. A corresponding unit test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #868 +/- ##
=======================================
Coverage 99.72% 99.72%
=======================================
Files 26 26
Lines 732 734 +2
Branches 204 205 +1
=======================================
+ Hits 730 732 +2
Misses 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@MadCcc 这个 PR 是否需要调整呢 |
What changed
items[].titlefor submenu items asitemTitlewhile keepinglabelas rendered submenu content.itemTitlefor the submenu title DOM attribute when present.itemswith differentlabelandtitle.Why
In the items conversion path, submenu items spread rest props and then set
title={label}. That overwrote a configuredtitle, so downstream consumers could not distinguish display label from native title text.Related
Validation
npm run lint(0 errors, existing warnings)./node_modules/.bin/tsc --noEmit --pretty false./node_modules/.bin/prettier --check src/SubMenu/index.tsx src/interface.ts src/utils/nodeUtil.tsx tests/Options.spec.tsxnpm test -- --runInBandnpm run coverage -- --runInBandnpm run compile