fix(menu): Use package import for sp-menu-divider registration#6420
fix(menu): Use package import for sp-menu-divider registration#6420Govind-gupta75 wants to merge 5 commits into
Conversation
|
Coverage Report for CI Build 27820598474Warning No base build found for commit Coverage: 96.24%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
Menu.ts registers via a relative side-effect import. In build systems that alias @spectrum-web-components/* packages (for example UXP wrappers), that relative path can resolve to a different module instance than the package export consumers use, causing duplicate custom element registration.
This follows the same fix applied in #3225 for MenuGroup, DialogBase, DialogWrapper, and Table.
Before
After
Problem
When extending SWC components in a wrapper layer and aliasing package paths (for example '@spectrum-web-components/menu': '@swc-uxp-internal/menu'), a relative import like ../sp-menu-divider.js may load the registration file from a different module graph than @spectrum-web-components/menu/sp-menu-divider.js. That can trigger:
NotSupportedError: Failed to execute 'define' on 'CustomElementRegistry':
the name "sp-menu-divider" has already been used with this registry
Motivation and context
Aligns Menu.ts with MenuGroup.ts, which already uses @spectrum-web-components/menu/sp-menu.js with the PR #3225 comment.
Ensures aliased/webpack-based builds register sp-menu-divider once.
No API or visual behavior change; import path only.
Related issue(s)
Related: #3225
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Descriptive Test Statement
Descriptive Test Statement
Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps (replace the placeholders with your component-specific instructions).
Keyboard (required — document steps below) — What to test for: Focus order is logical; Tab reaches the component and all interactive descendants; Enter/Space activate where appropriate; arrow keys work for tabs, menus, sliders, etc.; no focus traps; Escape dismisses when applicable; focus indicator is visible.
Screen reader (required — document steps below) — What to test for: Role and name are announced correctly; state changes (e.g. expanded, selected) are announced; labels and relationships are clear; no unnecessary or duplicate announcements.