Conversation
The upstream component with our namespaces, one deliberate deviation and the jQuery surface added: - The selectors and class hooks live in static getters, not module constants, so Dropdown can subclass Menu and keep the v5 markup working (the plan: workspace/plans/menu-and-dropdown-compat.md). dataApiKeydownHandler reads event.delegateTarget instead of a bound `this`, which lets the subclass register the same static with its own selectors, and _openInstances is a registry shared down the prototype chain, so one clearMenus handles every family. - SelectorEngine gains upstream's `closest` (additive). - Our lint caught upstream's `Array.at(-1)` — unsupported under the browser floors .browserslistrc declares — replaced with index access. - Spec ported (140 upstream tests) plus our additions: the jQueryInterface quartet and update()-with-reference coverage. One upstream branch (Escape inside a submenu reached through keyboard discovery) turns out unreachable from the documented markup — upstream's own suite leaves it uncovered too — so the branch floor moves to the measured 88.5 rather than gaining a synthetic spec; the reasoning lives next to the thresholds.
Upstream's _menu.scss translated token for token: prefixed --cui-menu-* custom properties backed by $menu-* Sass knobs (the customization API every component keeps), our theme indirection (--cui-theme-fg/-bg-subtle/-contrast/ -base) in place of their bare aliases, our palette hooks (tertiary-bg/-color, component-active-*, border-color-translucent, box-shadow-lg) and data-coreui-placement as the transform-origin hook. The @starting-style entry transition, display allow-discrete and the translucent variant come along unchanged.
…Menu One engine, two markups. Menu gained the three seams the subclass needs — events emitted through constructor.eventName (so the subclass speaks *.coreui.dropdown), a _removeMenuAttributes hook, and the selectors it already exposed as static getters. Dropdown shrinks from 552 lines of engine to ~210 lines of overrides: the v5 selectors, class-driven placement (dropup/dropend/--cui-position), the navbar/static data-coreui-popper hook, descendant item lookup for the <li>-wrapped v5 markup, and the jQuery surface. clearMenus is not re-registered — Menu's document-level handler iterates the open-instance registry the subclass shares. The acceptance contract: dropdown.spec.js untouched, 87/87 green on the subclass. Full suite 3453/3453. In exchange Dropdown quietly gains Menu's container teleport and floatingConfig passthroughs where the options overlap. bundlewatch budgets raised explicitly for the new component: Menu costs ~1.4 kB gzip across the bundles (submenus, hover intent, responsive placement), the named growth this branch delivers.
Upstream's menu.mdx with our namespaces, button classes, engine shortcodes (ScssDocs capture markers, plain markdown tables) and links; their interactive placement playground becomes a static two-button example, and the sections backed by site machinery we don't have (JsDependencies, JsDataAttributes, CSSVariables) are dropped. The Dropdown page opens with a callout that it is now a compatibility layer over Menu.
Three things the review caught: - Upstream's docs teach their composable class idiom (theme-* on menu items, btn-ghost theme-secondary) — the Tailwind-style API our bet explicitly rejects. The examples now speak CoreUI: text-* utilities tint items and btn btn-ghost-secondary is the button. The --cui-theme-* indirection stays in the SCSS as internal plumbing (alerts and tables use the same), it is just not the advertised API. - The selected-state examples nested <div class="menu-item-content"> inside <button>, which is invalid HTML (buttons take phrasing content) and failed the vnu gate on CI — now <span>, styled identically by the flex rules. - The Dropdown page callout and the migration guide now carry the decision: Dropdown is a compatibility layer and may be removed in v7 — prefer Menu for new work.
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.
Adds the Menu component (ported from Bootstrap v6) and rebuilds Dropdown on top of it — one engine, two markups. Plan and findings:
workspace/plans/menu-and-dropdown-compat.md.The architecture
Menu is the implementation; Dropdown is a ~210-line subclass carrying the v5 surface. The acceptance contract was the untouched v5 spec suite:
dropdown.spec.jspasses 87/87 without a single changed line.Three seams made the subclass possible (the one deliberate deviation from upstream):
.menu/.menu-itemfor.dropdown-menu/.dropdown-itemconstructor.eventName, so the subclass speaks*.coreui.dropdowndataApiKeydownHandlerreadsevent.delegateTargetinstead of a boundthis, and_openInstancesis a registry shared down the prototype chain — one document-levelclearMenusdismisses both familiesDropdown keeps: class-driven placement (
dropup/dropend/--cui-position), the navbar/staticdata-coreui-popperCSS hook, descendant item lookup for the<li>-wrapped v5 markup, and the jQuery surface. It quietly gains Menu's container teleport andfloatingConfigwhere options overlap.What Menu brings
Submenus (hover intent with triangle tracking, keyboard entry/exit), container teleport, responsive placement (
"bottom-start md:top-end"on our breakpoints), logicalstart/endplacements,@starting-styleentry transition, scrollable and translucent variants.Also in here
_menu.scsstranslated onto our token conventions ($menu-*knobs,--cui-theme-*indirection,data-coreui-placementtransform-origin hooks)SelectorEngine.closest(additive, from upstream)Array.at(-1)— unsupported under the browser floors.browserslistrcdeclares — replaced with index accessNumbers and honest costs
createAnchoredPositionhelper (touches six existing components — own PR), thecoreui-internal-linksentry (needs live URLs, lands with the v6 docs deploy), and Home/End keys in the compat layer (a Menu feature v5 never had)