Skip to content

feat(Button): add focus outline offset - #7708

Merged
thatblindgeye merged 3 commits into
patternfly:mainfrom
kmcfaul:button-focus-offset
Aug 19, 2025
Merged

thatblindgeye merged 3 commits into
patternfly:mainfrom
kmcfaul:button-focus-offset

Conversation

@kmcfaul

@kmcfaul kmcfaul commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

Closes #6428

@srambach Is there a particular token we want to use for the outline offset? I looked at other instances of the offset and didn't notice a standard so went with a small value to start.

@patternfly-build

patternfly-build commented Jul 31, 2025 •

Copy link
Copy Markdown
Collaborator

@mcoker

mcoker commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

@kmcfaul there will be tokens for focus outlines coming next quarter probably, so the manual size you have works for now.

@mcoker
mcoker requested review from mcoker and srambach August 4, 2025 14:35

@srambach srambach left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good afaict, looking cross-browser, light/dark, etc.

@mcoker
mcoker requested a review from thatblindgeye August 8, 2025 00:31
@mcoker

mcoker commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Just poking around for a little bit, the titles in this card demo no longer show well (before and after below) due to an overflow issue. We can try and address these, but there will probably be issues like this that pop up considering how common the button in all kinds of layouts.

Screenshot 2025-08-07 at 7 31 26 PM Screenshot 2025-08-07 at 7 31 36 PM

@lboehling this moves the focus outline 2px outside of the button component. WDYT? Given the upcoming focus state changes, is the recommendation still to move the outline outside of the button? #6428 (comment)

@mcoker
mcoker requested a review from lboehling August 8, 2025 02:34
@lboehling

lboehling commented Aug 15, 2025 •

Copy link
Copy Markdown

Just poking around for a little bit, the titles in this card demo no longer show well (before and after below) due to an overflow issue. We can try and address these, but there will probably be issues like this that pop up considering how common the button in all kinds of layouts.

Screenshot 2025-08-07 at 7 31 26 PM Screenshot 2025-08-07 at 7 31 36 PM
@lboehling this moves the focus outline 2px outside of the button component. WDYT? Given the upcoming focus state changes, is the recommendation still to move the outline outside of the button? #6428 (comment)

The most recent token update pulled in focus-ring specific design tokens! --pf-t--global--focus-ring--position--offset is set to 2px 👍

image

There are also global tokens now added for focus-ring--width & focus-ring--color too if we wanted to use those.

image image

@mcoker

mcoker commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

@logonoff in #7420, you added overflow: auto; to .pf-v6-c-card__title-text. That's causing an issue with hiding overflow on the title element. Do you remember why that was needed for that fix? I don't see it in the catalog view PR that the fix came from, and AFAIK that isn't needed to break long strings of text using overflow-wrap.

If @logonoff can confirm that style isn't needed, @kmcfaul do you mind also removing overflow: auto from __title-text?

That should fix the outline focus outline being cut off in my comment above.

@logonoff

logonoff commented Aug 15, 2025 •

Copy link
Copy Markdown
Member

If @logonoff can confirm that style isn't needed, @kmcfaul do you mind also removing overflow: auto from __title-text?

I don't remember why we needed overflow: auto for that fix, what I can say though is that without the overflow: auto style, the bug still appears to be fixed for regular cards:

image

However during testing I noticed that the issue still appears for actionable/selectable cards (the card become scrollable instead of wrapping):

image

But this bug still occurs even with overflow: auto, so I think it's safe to remove 😸

@kmcfaul
kmcfaul force-pushed the button-focus-offset branch from ab7b8f5 to 6126446 Compare August 18, 2025 19:12

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@lboehling lboehling left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🌟

@thatblindgeye
thatblindgeye merged commit e04665f into patternfly:main Aug 19, 2025
4 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.3.0-prerelease.50 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Button - Focus accessibility issue

7 participants