-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix HeaderButton
endIcon
styles
#2369
base: main
Are you sure you want to change the base?
Conversation
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 is a no-go, because it will affect even icons that aren't part of a dropdown/popover button. I do agree that the problem needs to be solved, but this is not the way.
(Also, we should try to avoid cloning nodes and referencing styles
within components. But that's not the main reason for blocking this PR.)
True, but that was actually intended. Because, for example, I felt even if the I updated the playground linked in the PR description to also show a non dropdown/popover After this PR, the
Open to other suggestions too 🙂 |
If it's intended, this change should probably be made separately (or maybe this PR can be repurposed). It sounds unrelated to the issue this PR is aimed at solving, i.e. helping consumers use If you take a look at the code for
We can discuss potential solutions separately outside this PR. It will require a larger change and maybe new APIs. One thing that comes to mind is we should probably deprecate |
Changes
Noticed that the
HeaderButton
'sendIcon
was not getting the end icon styles similar to the end icon styles inHeaderDropdownButton
andHeaderSplitButton
(e.g. still have the down/up caret end icon). This PR clonesendIcon
inHeaderBasicButton
to add theiui-header-breadcrumb-button-dropdown-icon
class to get those end icon styles. It also addsaria-hidden: true
.Since
HeaderBasicButton
now adds that class andaria-hidden
,HeaderDropdownButton
no longer needs to add that class to theendIcon
in its internal usage ofHeaderBasicButton
.This PR is particularly helpful for users who want to show a
Popover
inHeaderButton
but keep the button styles exactly similar toHeaderDropdownButton
. This is because passing non-MenuItem
s inHeaderButton
'smenuItem
prop is bad for accessibility sincerole: menu
expectsrole: menuitem
children (among other supported children).Code
i.e. The following is not recommended for non-MenuItem content:Following is the recommended alternative. In this implementation, the
endIcon
will now have the correct style and accessibility properties:Testing
CI still passing.
Tested in the playground:
Docs
Added changeset.