Skip to content

Render Dropdown as its own button - #402

Merged
matthewbirtch merged 4 commits into
mainfrom
cursor/dropdown-padding-hover-specificity-9479
Nov 18, 2026
Merged

matthewbirtch merged 4 commits into
mainfrom
cursor/dropdown-padding-hover-specificity-9479

Conversation

@matthewbirtch

@matthewbirtch matthewbirtch commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Dropdown no longer composes Compass Button. The trigger is its own <button type="button">, so padding, hover, active, focus, and disabled live only on .dropdown and no longer tie a quaternary medium Button.

Public props are unchanged: size, padding, appearance, isOpen, leadingIcon, disabled, and button attributes including aria-*. The repeated-class overrides, the --button-fg overrides, and the display: contents rule that undid Button's label wrapper are gone.

Default markup changes. The trigger no longer has Button's classes or the button__label wrapper. Consumer updates are separate; this PR does not touch mattermost-plugin-agents#1231.

The Dropdown guideline puts the Anatomy and Inverted labels in expressions ({'design'}) so MDX does not wrap them in a <p>. A label on its own line was becoming a paragraph, and the docs prose margin showed up inside those triggers.

Why

Dropdown rendered Compass Button at emphasis="quaternary" and size="medium", then overrode almost everything Button provides: padding, hover, active, focus, colour, and the button__label wrapper. Both class sets sat on the same element at equal specificity. When the Button stylesheet loaded after Dropdown's, a large Dropdown picked up Button's medium padding (var(--spacing-s) var(--spacing-xl), 12px 24px) and the quaternary link-coloured hover and active wash, instead of Dropdown's own padding and the center-channel wash.

Repeating the dropdown class three times already beat Button for --button-fg and the inverted hover, and the same trick would have covered size padding and the default hover. That still leaves Dropdown coupled to Button's DOM and to whichever Button styles land next. Rendering the trigger as its own button removes the tie.

Screenshots / demo video (required)

N/A for a new visual treatment. The padding, hover, active, focus, and disabled values are the same rules as before. They now belong to the Dropdown button instead of competing with a Button stylesheet.

Test plan

  • Dropdown.test.tsx: the root is a button type="button" with Dropdown classes, aria-expanded, aria-haspopup, and no button--* class or button__label wrapper. disabled, isOpen, and leadingIcon still apply.
  • stylelint and eslint on the changed files
  • npm test --workspace=@mattermost/compass-ui (635 tests)
  • Compiled dropdown.guideline.mdx: Anatomy and Inverted labels are strings, not <p> children.
Open in Web Open in Cursor 

Change Impact: 🟡 Medium

Changes Breakdown:

+11 -27 Production Changes (51%)
+37 -0 Test Changes (49%)

Regression Risk: The Dropdown trigger changes from a Compass Button composition to a native <button>, and the label wrapper and --button-fg overrides are removed. Default markup and cascade change for all consumers, while the new tests check rendering and ARIA state only, so visual regressions and selectors that target Button classes or button__label are not covered.

Generated by CodeRabbitAI

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Dropdown now renders its trigger as a native button instead of the shared Button component. Its existing button attributes and contents remain. The stylesheet removes Button-specific colour overrides and the direct-child span display rule.

Changes: Dropdown trigger

Layer / File(s) Summary
Native trigger rendering and styling
packages/compass-ui/src/components/Dropdown/Dropdown.tsx, packages/compass-ui/src/components/Dropdown/Dropdown.module.scss
Dropdown renders a native button with its existing type, disabled state, ARIA attributes, forwarded props, and content. The stylesheet removes Button-specific colour overrides and the direct-child span display rule.
Rendering coverage and supporting text
packages/compass-ui/src/components/Dropdown/Dropdown.test.tsx, packages/compass-ui/CHANGELOG.md, src/guidelines/components/dropdown/dropdown.guideline.mdx
Tests check the trigger’s classes, accessible label, listbox attributes, child content, disabled and open states, and leading icon. The changelog records the markup and styling changes. Guideline examples wrap string children in braces.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: compass-ui

Merge Risk: Low · up to a44ad

Dropdown now renders its own native button, so the default markup no longer includes Button classes or the label wrapper. Consumers whose selectors depend on the old structure may break until they are updated. The change is small and reversible, so merge risk is low, but the consumer updates should be tracked.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Render Dropdown as its own button" names the main change. The changeset stops Dropdown from composing Compass Button and renders a native button for the trigger. The title is specific and c…
Description check Passed The description covers the summary, the reason for the change, the test plan, and the required screenshot section. It marks the screenshot section as N/A and gives a reason, which the template allows …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Render Dropdown as its own button" names the main change. The changeset stops Dropdown from composing Compass Button and renders a native button for the trigger. The title is specific and concise, and it matches the objectives.

Full details: Description check

Explanation

The description covers the summary, the reason for the change, the test plan, and the required screenshot section. It marks the screenshot section as N/A and gives a reason, which the template allows for non-visual changes. The author also states that the default markup changes and that consumer updates are separate. The Downstream section is omitted, but the template says to delete it when consumers are not affected. Some sections use the Cursor agent wrapper and footer. The description still contains enough detail to review the change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3b9e752b-12fd-477f-aa8b-ad4f0edf7643
Commits

Reviewing files that changed from the base of the PR and between 96b4cde and a44ad47.

Files selected for processing: 1

  • src/guidelines/components/dropdown/dropdown.guideline.mdx

Limit details: You’ve used all 2 included reviews currently available. Your 57 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 6777a4e7-b80d-405d-9b6e-ff66de347184
Commits

Reviewing files that changed from the base of the PR and between c41acd3 and 9afeca0.

Files selected for processing: 3

  • packages/compass-ui/CHANGELOG.md
  • packages/compass-ui/src/components/Dropdown/Dropdown.cascade.test.ts
  • packages/compass-ui/src/components/Dropdown/Dropdown.module.scss

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@cursor cursor Bot changed the title Fix Dropdown padding and hover losing to Button Render Dropdown as its own button Nov 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 0575c6ec-f9f6-4c56-a2aa-e0f4ad38acef
Commits

Reviewing files that changed from the base of the PR and between f99cdc3 and 491d283.

Files selected for processing: 4

  • packages/compass-ui/CHANGELOG.md
  • packages/compass-ui/src/components/Dropdown/Dropdown.module.scss
  • packages/compass-ui/src/components/Dropdown/Dropdown.test.tsx
  • packages/compass-ui/src/components/Dropdown/Dropdown.tsx
Files skipped from review as they are similar to previous changes: 1

  • packages/compass-ui/CHANGELOG.md

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

cursoragent and others added 3 commits November 18, 2026 21:02
Dropdown renders a quaternary medium Button, so size padding and the
default hover and active wash tied Button's rules. A later Button
stylesheet then painted Button's padding and the link-coloured wash.
Repeat the dropdown class, the same way --button-fg and inverted hover
already do, so Dropdown wins whichever sheet loads last.

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
pathname keeps percent-encoding, so a checkout path with a space would
make the suite fail while compiling the stylesheets.

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Stop composing Compass Button, so padding, hover, active, focus, and
disabled live only on .dropdown. Drop the repeated-class overrides,
--button-fg, and the label-wrapper display:contents rule. The trigger
no longer has Button classes or a button__label span.

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
@cursor
cursor Bot force-pushed the cursor/dropdown-padding-hover-specificity-9479 branch from 491d283 to 96b4cde Compare November 18, 2026 21:02
MDX treats a label on its own line as a paragraph, and the docs prose
margin then shows inside the trigger. Expressions stay strings.

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
@matthewbirtch
matthewbirtch merged commit 8cde68a into main Nov 18, 2026
7 checks passed
@matthewbirtch
matthewbirtch deleted the cursor/dropdown-padding-hover-specificity-9479 branch November 18, 2026 21:08
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