-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Global Styles Sidebar: Rename NavigationButton
so semantics are clearer
#40590
Conversation
Size Change: +4 B (0%) Total Size: 1.23 MB
ℹ️ View Unchanged
|
<ItemGroup> | ||
<NavigationButtonAsItem path="/variations"> |
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.
This "fixes" the semantic issue, but wrapping this single item in an ItemGroup
is not ideal. Ideally I would like to use a vanilla NavigatorButton
here instead of the Item
-wrapped version, but unfortunately there is a styling inconsistency (#40591) that makes that weird too.
I think we can go with this bandaid fix, since we'll probably overhaul this view (#40478) anyway.
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.
What about overriding the role
, so that at least we don't have a semantically weird one-item list ?
<ItemGroup> | |
<NavigationButtonAsItem path="/variations"> | |
<ItemGroup role={ null }> | |
<NavigationButtonAsItem | |
path="/variations" | |
role={ null } | |
> |
Just a caveat: eslint complains about passing null
as a value, but it's the only way to properly override this value (passing undefined
would make ItemGroup
and Item
fallback on their default role
values)
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.
Yeah, I'm hesitant to do that too since I agree with eslint that role={ null }
is not at all kosher 😅 And neither is role="generic"
, apparently.
My preference would be to fix the focus outline inconsistency so we can just use a vanilla NavigatorButton
. (A potential path to overriding semantics cleanly is the as
prop though.)
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.
Agreed. Let's improve the focus outline inconsistency, and then look at a way to rewrite ItemGroup
in a way that makes possible using as
to override semantics (together with a few other tweaks that we took note of)
<View role="list"> | ||
<NavigationBackButtonAsItem |
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.
This bandaid fix will be ripped off in #40592.
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.
LGTM
<ItemGroup> | ||
<NavigationButtonAsItem path="/variations"> |
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.
What about overriding the role
, so that at least we don't have a semantically weird one-item list ?
<ItemGroup> | |
<NavigationButtonAsItem path="/variations"> | |
<ItemGroup role={ null }> | |
<NavigationButtonAsItem | |
path="/variations" | |
role={ null } | |
> |
Just a caveat: eslint complains about passing null
as a value, but it's the only way to properly override this value (passing undefined
would make ItemGroup
and Item
fallback on their default role
values)
Part of #38934
Based on #40588
What?
NavigationButton
toNavigationButtonAsItem
, so future devs are less likely to make the same mistake.Why?
There was a local component called
NavigationButton
, which hadlistitem
semantics under the hood but were mistakenly reused in non-list contexts.How?
See PR code comments for specifics.
Testing Instructions
npm run dev