Skip to content

Components: Fix double border in ItemGroup when last item is focused #70021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2025

Conversation

im3dabasia
Copy link
Contributor

@im3dabasia im3dabasia commented Apr 30, 2025

What?

Closes #61621

Fixes double border issue in ItemGroup when last item is focused.

Why?

Previously, the border was only removed when the item was not focused, causing a double border when the last item received focus.

How?

Modified the separated CSS to remove the bottom border on the last child item in all states rather than only in the non-focused state.

Testing Instructions

  1. Run npm run storybook:dev to start the storybook.
  2. Open the ItemGroup component in Storybook.
  3. Emulate the :focus state on the last item using browser developer tools.
  4. Verify the fix removes the double border when the last item is focused

Notes

The snapshots for the tests need to be updated thats probably the reason why unit tests are failing. I am not aware on how to update them. I would appreciate some guidance here.

Screenshots or screencast

Before

Screen.Recording.2025-04-30.at.4.58.00.PM.mov

After

Screen.Recording.2025-04-30.at.4.56.24.PM.mov

@im3dabasia im3dabasia requested a review from ajitbohra as a code owner April 30, 2025 11:33
Copy link

github-actions bot commented Apr 30, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: madhusudhand <madhudollu@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components labels Apr 30, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I've read all of #30097 where this style was added, but I'm really not sure why :focus state was ignored from the selector. Perhaps it may be necessary for the first implementation, but I believe it shouldn't be needed anymore for now.

The snapshots for the tests need to be updated thats probably the reason why unit tests are failing. I am not aware on how to update them. I would appreciate some guidance here.

Run: npm run test:unit packages/components/src/item-group/test/index.js -- -u

@im3dabasia im3dabasia force-pushed the fix/item-group-double-border branch from eedaec5 to 1c6040d Compare May 2, 2025 10:58
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@t-hamano t-hamano merged commit bcc41b1 into WordPress:trunk May 3, 2025
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.8 milestone May 3, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
WordPress#70021)

* fix: Make border transparent for all pseudo events

* chore: Add changelog entry

* chore: Update snapshots

Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: madhusudhand <madhudollu@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigatorButton has double border on focus state
3 participants