Skip to content

feat(menu-dropdown): add LWC button-menu variants and xx-small icon size - #3235

Merged
interactivellama merged 2 commits into
masterfrom
feat/menu-dropdown-lwc-variants
Oct 29, 2026
Merged

interactivellama merged 2 commits into
masterfrom
feat/menu-dropdown-lwc-variants

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

Adds the lightning-button-menu trigger variants, icon size, and menu alignments that MenuDropdown was missing. The class logic was checked against the LWC buttonMenu source in lightning-base-components.

Prop New values What they render
iconVariant bare-inverse, border-inverse Same as bare / border with buttonInverse. MenuDropdown converts them before passing them to the trigger, so Button is unchanged and custom triggers receive bare/border + inverse.
iconSize xx-small slds-button_icon-xx-small on the button. SLDS has no xx-small class for the icon itself, so the size only applies when an iconVariant is set (LWC also only sizes the button). ButtonIconSize in components/button gains xx-small.
align bottom-left, bottom-center, bottom-right Menu opens above the trigger, with the same slds-dropdown_bottom / _left / _right classes as LWC.
align auto Left-aligned below the trigger, and flips to stay in view even when hasStaticAlignment is set.

Judgment call on auto: DSR menus already flip by default (unlike LWC, where only auto repositions), so without this auto would be the same as left. Making it ignore hasStaticAlignment is the closest match to LWC. menuPosition="relative" menus are positioned by CSS alone and never flip; the JSDoc notes this.

Not a breaking change: every addition widens an existing union type, and existing values render the same markup. No existing story snapshot changed.

Commits: style(menu-dropdown) is formatting only (the pre-commit hook formats whole files, and these weren't formatted on master). The feat commit has the functional diff.

Tests and stories

  • jsdom (dropdown.test.jsx): trigger classes for the inverse variants and xx-small, and menu position classes for each align value.
  • Browser (dropdown.browser.test.jsx, new): uses the real SLDS stylesheet in absolute and relative mode to check that each alignment opens above or below the trigger and lines up with the correct edge. Also checks that auto flips with hasStaticAlignment when there's no room below, and left doesn't.
  • New stories: Alignments, InverseIconVariants, IconSizes, plus Storybook controls for align, iconVariant, and iconSize.

Existing behavior noticed but not changed: when a menu flips upward, it overlaps the trigger by 2px because .slds-dropdown's top margin still applies.


CONTRIBUTOR checklist (do not remove)

Please complete for every pull request.

Green gate — all of these must pass locally (CI runs the same):

  • npm run lint passes with 0 errors (npm run lint:fix to auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.
  • npm run typecheck is clean (tsc --noEmit).
  • npm test -- --run passes — this runs both Vitest projects (jsdom unit + real-browser browser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots with npm test -- --run -u and review the diff.
  • npm run build succeeds (type-check + Vite library build + .d.ts + entry shims).

Behavior & docs:

  • First-time contributors: sign the CLA (a bot will comment with instructions).
  • Added/updated Vitest + React Testing Library tests for the change (template: components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a *.browser.test.jsx file (the browser project); everything else is jsdom.
  • Reviewed the component's Storybook stories: npm run storybook → http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).
  • Story/example code uses the component's real prop API (e.g. render-props like onRenderContent / onRenderVisualPicker, icon props, events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check against components/<name>/__examples__.
  • Storybook Accessibility (a11y) panel shows no new violations for the affected stories.
  • If you added or changed a type, remember runtime PropTypes were removed in the TS migration — types are the contract. Ship accurate .d.ts (they're generated by the build); JS consumers rely on them via editor type-acquisition.

REVIEWER checklist (do not remove)

  • CI is green (GitHub Actions CI workflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.
  • Change has adequate test coverage; bug fixes include a regression test.
  • Reviewed the affected Storybook stories and their a11y panels.
  • Rendered markup still conforms to SLDS — check the story HTML snapshot diff (components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).
  • Public API / package surface: if exports changed, the deep-import contract still holds (@salesforce/design-system-react/components/<name> and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change → feat!:/BREAKING CHANGE: and a major version bump.

🤖 Generated with Claude Code

@Niznikr Niznikr changed the title Title: feat(menu-dropdown): add LWC button-menu variants, xx-small icon size, and alignments feat(menu-dropdown): add LWC button-menu variants, xx-small icon size, and alignments Oct 21, 2026
@interactivellama

Copy link
Copy Markdown
Contributor

@Niznikr Please resolve conflicts.

@interactivellama

Copy link
Copy Markdown
Contributor

Please remove the alignment features. After closer inspection, fighting floating-ui isn't worth in my opnion.

Screenshot 2026-10-26 at 3 14 15 PM

Niznikr and others added 2 commits October 27, 2026 11:18
Formatting-only changes to files touched by the upcoming menu-dropdown
LWC parity change, split out so the functional diff stays reviewable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l icon size

Match lightning-button-menu's trigger options.

- `iconVariant` accepts `bare-inverse` and `border-inverse`. MenuDropdown
  converts them to `bare`/`border` plus `inverse` before passing them to
  the trigger, so they render the same as `buttonInverse` does today.
- `iconSize` accepts `xx-small`, passed through to Button, which applies
  `slds-button_icon-xx-small` when an `iconVariant` is set.

Adds jsdom tests for the trigger classes and InverseIconVariants and
IconSizes stories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Niznikr
Niznikr force-pushed the feat/menu-dropdown-lwc-variants branch from dbf81de to 44708a8 Compare October 27, 2026 15:20
@interactivellama
interactivellama merged commit e53eed1 into master Oct 29, 2026
9 checks passed
@interactivellama
interactivellama deleted the feat/menu-dropdown-lwc-variants branch October 29, 2026 19:53
@interactivellama interactivellama changed the title feat(menu-dropdown): add LWC button-menu variants, xx-small icon size, and alignments feat(menu-dropdown): add LWC button-menu variants and xx-small icon size Oct 29, 2026
interactivellama pushed a commit that referenced this pull request Oct 29, 2026
…, and alignments (#3235)

* style(menu-dropdown): apply prettier formatting

Formatting-only changes to files touched by the upcoming menu-dropdown
LWC parity change, split out so the functional diff stays reviewable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(menu-dropdown): add LWC button-menu inverse variants and xx-small icon size

Match lightning-button-menu's trigger options.

- `iconVariant` accepts `bare-inverse` and `border-inverse`. MenuDropdown
  converts them to `bare`/`border` plus `inverse` before passing them to
  the trigger, so they render the same as `buttonInverse` does today.
- `iconSize` accepts `xx-small`, passed through to Button, which applies
  `slds-button_icon-xx-small` when an `iconVariant` is set.

Adds jsdom tests for the trigger classes and InverseIconVariants and
IconSizes stories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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