Skip to content

Commit 2f143ce

Browse files
ciampomirka
andauthored
ui/CollapsibleCard: do not animate focus ring (WordPress#76682)
* ui/CollapsibleCard: prevent focus ring from animating when expanding/collapsing the card * CHANGELOG --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
1 parent 825ec4b commit 2f143ce

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

packages/ui/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Bug Fixes
1010

1111
- `Card`: Add `overflow: clip` to `Card.Root` to prevent child content from overflowing rounded corners ([#76678](https://github.com/WordPress/gutenberg/pull/76678)).
12+
- `CollapsibleCard`: do not animate the focus ring when expanding/collapsing the card ([#76459](https://github.com/WordPress/gutenberg/pull/76459)).
1213

1314
### Internal
1415

packages/ui/src/collapsible-card/header.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,23 @@ export const Header = forwardRef< HTMLDivElement, HeaderProps >(
3535
nativeButton={ false }
3636
>
3737
<div className={ styles[ 'header-content' ] }>{ children }</div>
38-
<div className={ styles[ 'header-trigger-wrapper' ] }>
39-
<Icon
40-
icon={ chevronDown }
38+
<div
39+
className={ clsx( styles[ 'header-trigger-positioner' ] ) }
40+
>
41+
<div
4142
className={ clsx(
42-
styles[ 'header-trigger' ],
43+
styles[ 'header-trigger-wrapper' ],
4344
// While the interactive trigger element is the whole header,
4445
// the focus ring will be displayed only on the icon to visually
4546
// emulate it being the button.
4647
focusStyles[ 'outset-ring--focus-parent-visible' ]
4748
) }
48-
/>
49+
>
50+
<Icon
51+
icon={ chevronDown }
52+
className={ styles[ 'header-trigger' ] }
53+
/>
54+
</div>
4955
</div>
5056
</Collapsible.Trigger>
5157
);

packages/ui/src/collapsible-card/style.module.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
min-width: 0;
77
}
88

9-
.header-trigger-wrapper {
9+
.header-trigger-positioner {
1010
flex-shrink: 0;
1111
align-self: center;
1212
/* Prevent the trigger from making the header taller than its content,
@@ -15,15 +15,19 @@
1515
overflow: visible;
1616
}
1717

18-
.header-trigger {
18+
.header-trigger-wrapper {
19+
display: flex;
20+
1921
/* Offset by half the button's own height so it visually centers
2022
at the wrapper's midpoint (which `align-self: center` places at
2123
the vertical center of the header). */
2224
translate: 0 -50%;
2325

2426
/* For an outline that looks like `IconButton`'s */
2527
border-radius: var(--wpds-border-radius-sm);
28+
}
2629

30+
.header-trigger {
2731
@media not (prefers-reduced-motion) {
2832
transition: rotate 0.15s ease-out;
2933
}

0 commit comments

Comments
 (0)