Skip to content
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
1 change: 1 addition & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Bug Fixes

- DataForm: Fix label color of array control. [#75730](https://github.com/WordPress/gutenberg/pull/75730)
- DataForm: Fix `card` layout's toggle button screen reader text. [#76039](https://github.com/WordPress/gutenberg/pull/76039)
- DataViews: Fix focus transfer while searching in `list` layout. [#75999](https://github.com/WordPress/gutenberg/pull/75999)
- DataForm: Fix focus loss when collapsing in Card view. [#75689](https://github.com/WordPress/gutenberg/pull/75689)
- DataViews: Avoid flickering while refreshing. [#74572](https://github.com/WordPress/gutenberg/pull/74572)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
useRef,
useState,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { chevronDown, chevronUp } from '@wordpress/icons';

/**
Expand Down Expand Up @@ -99,10 +98,9 @@ export default function FormCardField< Item >( {
const { fields } = useContext( DataFormContext );
const layout = field.layout as NormalizedCardLayout;
const cardBodyRef = useRef< HTMLDivElement >( null );
const bodyId = useInstanceId(
FormCardField,
'dataforms-layouts-card-card-body'
);
const instanceId = useInstanceId( FormCardField );
const bodyId = `dataforms-layouts-card-card-body-${ instanceId }`;
const titleId = `dataforms-layouts-card-card-title-${ instanceId }`;

const form: NormalizedForm = useMemo(
() => ( {
Expand Down Expand Up @@ -240,7 +238,10 @@ export default function FormCardField< Item >( {
alignItems: 'center',
} }
>
<span className="dataforms-layouts-card__field-header-label">
<span
id={ titleId }
className="dataforms-layouts-card__field-header-label"
>
{ label }
</span>
{ validationBadge }
Expand All @@ -266,9 +267,7 @@ export default function FormCardField< Item >( {
icon={ isOpen ? chevronUp : chevronDown }
aria-expanded={ isOpen }
aria-controls={ bodyId }
aria-label={
isOpen ? __( 'Collapse' ) : __( 'Expand' )
}
aria-labelledby={ titleId }
/>
) }
</OriginalCardHeader>
Expand Down
Loading