-
Notifications
You must be signed in to change notification settings - Fork 1k
Add ability for compound focus indicator #7479
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
Conversation
}; | ||
shadow?: | ||
| string | ||
| { | ||
color?: ColorType; | ||
size?: string; | ||
blur?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to include allowAll
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you. Will add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation and functionality look good.
One question re: theme property name.
src/js/themes/base.js
Outdated
@@ -281,6 +281,7 @@ export const generate = (baseSpacing = 24, scale = 6) => { | |||
color: 'focus', | |||
size: '2px', | |||
}, | |||
allowAll: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pausing on the name of this property. From a Grommet convention, typically we haven't used verbs, instead use a noun / specific property.
How were we thinking of describing this in the documentation? Something like?:
If true, applies both outline and shadow styles to create a compound focus ring.
OR,
If true, applies both outline and shadow styles to create a two-color focus ring.
A couple naming options:
twoColor
compound
"Two-color" seemed to be the most common terminology used in search results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feedback, let's use the term twoColor
since it speaks to the technique this is seeking to enable.
What does this PR do?
Enhances Grommet theme to allow for user to do compound focus style that combines both "outline" and "box-shadow" -- this is useful to enable alignment to WCAG recommendation: https://www.w3.org/WAI/WCAG21/Techniques/css/C40
Previously, Grommet would should outline or shadow, so the caller's theme must "opt-in" via
theme.global.focus.twoColor
.Where should the reviewer start?
What testing has been done on this PR?
Locally and added jest test
Screen.Recording.2025-01-23.at.5.21.02.PM.mov
How should this be manually tested?
Do Jest tests follow these best practices?
screen
is used for querying.asFragment()
is used for snapshot testing.Any background context you want to provide?
What are the relevant issues?
Closes #7475
Screenshots (if appropriate)
Do the grommet docs need to be updated?
Should this PR be mentioned in the release notes?
Is this change backwards compatible or is it a breaking change?