From e86152bc8b45d5fe213ed688f145e82f73bb2fd4 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 10 Oct 2024 04:27:55 +0900 Subject: [PATCH] ToggleGroupControl: Don't autoselect option on first group focus (#65892) * ToggleGroupControl: Don't autoselect option on first group focus * Fix test * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo Co-authored-by: tyxla Co-authored-by: Mamaduka Co-authored-by: jeryj --- packages/components/CHANGELOG.md | 1 + .../test/__snapshots__/index.tsx.snap | 12 ++++----- .../src/toggle-group-control/test/index.tsx | 13 ++++++++++ .../component.tsx | 26 ++++++++----------- .../toggle-group-control/as-radio-group.tsx | 3 +++ .../src/toggle-group-control/types.ts | 1 + 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 4ae124347187e7..a532fda22f972f 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -7,6 +7,7 @@ - `PaletteEdit`: dedupe palette element slugs ([#65772](https://github.com/WordPress/gutenberg/pull/65772)). - `RangeControl`: do not tooltip contents to the DOM when not shown ([#65875](https://github.com/WordPress/gutenberg/pull/65875)). - `Tabs`: fix skipping indication animation glitch ([#65878](https://github.com/WordPress/gutenberg/pull/65878)). +- `ToggleGroupControl`: Don't autoselect option on first group focus ([#65892](https://github.com/WordPress/gutenberg/pull/65892)). ### Enhancements diff --git a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap index d2d98eaba85e6f..832c6d7cb7a8c8 100644 --- a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap +++ b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap @@ -283,7 +283,7 @@ exports[`ToggleGroupControl controlled should render correctly with icons 1`] = class="components-toggle-group-control emotion-8 emotion-9" data-wp-c16t="true" data-wp-component="ToggleGroupControl" - id="toggle-group-control-as-radio-group-11" + id="toggle-group-control-as-radio-group-12" role="radiogroup" >