Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ninety-weeks-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Added expanded styling to Button
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
background-color: var(--p-color-bg-fill-tertiary-hover) !important;
}

&:active {
/* stylelint-disable-next-line selector-no-qualifying-type -- add expanded styling */
&:active,
&[aria-expanded='true'] {
background-color: var(--p-color-bg-fill-tertiary-active) !important;
box-shadow: var(--p-shadow-inset-200) !important;
}
Expand Down
19 changes: 19 additions & 0 deletions polaris-react/src/components/Button/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,25 @@
text-decoration: underline;
}
}
// Overrides for popover active / expanded states on default buttons
.Button:is([aria-expanded='true']):is([aria-owns]):not(.variantPlain):not(.variantMonochromePlain):not(.variantTertiary):not(.variantPrimary) {
// stylelint-disable-next-line polaris/conventions/polaris/custom-property-allowed-list -- custom property
--pc-button-shadow: var(--p-shadow-inset-200);
background: var(--p-color-bg-fill-active);

.Content {
transform: translateY(1px);
}

&:hover {
// stylelint-disable-next-line polaris/conventions/polaris/custom-property-allowed-list -- reset custom property for expaned button
box-shadow: var(--pc-button-shadow);
}
}
// Overrides for popover active / expanded states on plain, monochromePlain, tertiary buttons
.Button:is([aria-expanded='true']):is([aria-owns]):is(.variantTertiary) {
background: var(--p-color-bg-fill-transparent-active);
}

[data-buttongroup-variant='segmented'] {
.Button,
Expand Down
5 changes: 4 additions & 1 deletion polaris-react/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export interface PopoverProps {
preferredAlignment?: PopoverOverlayProps['preferredAlignment'];
/** Show or hide the Popover */
active: boolean;
/** The element to activate the Popover */
/** The element to activate the Popover.
* If using a button, use the default or tertiary variant
* which will show an active state when popover is active
*/
activator: React.ReactElement;
/**
* Use the activator's input element to calculate the Popover position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Popovers should:
- Be used for secondary or less important information and actions since they’re hidden until merchants hit the trigger
- Contain navigation or actions that share a relationships to each other
- Be triggered by a clearly labeled button
- Use a default or tertiary button as the activator

---

Expand Down