-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
SearchBox role is hardcoded and can not be changed. #14914
Comments
@ilyatum Thanks for reaching out. Let's follow up to better understand the experience that you are trying achieve. @ecraig12345 - Is this by design? |
SearchBox is a bit weird because the native props are applied to the inner One possible solution is adding a new prop The other possible solution is switching to apply native props to the root (and adding separate |
@ecraig12345 Thanks for analysis. Sounds like we need to make a decision on whether this is something we address in v7, v8, or when we converge |
Hi, there is an issue that is resulted in the hardcoded SearchBox's role. When we use SearchBox in the CommandBar, it's role is hardcoded, hence the "menuitem" role wouldn't be added to the tag. Then the screenreader wouldn't include the SearchBox when announcing the menuitems. For instance, a CommandBar like this, if user were on the first item, the screenreader would say, "item 1 of 5", instead of "1 of 6". User who uses screenreader then would be misled on the number of menuitems. Wonder when there would be a fix? Follow up after 14 days @paulgildea sorry for mentioning you -- wanted to get some feedback/update :) |
When we were discussing this previously, @dzearing asked @smhigley about it and the suggestion was that since the |
Couldn't we just default to search unless provided? |
Would seem like a non breaking change that could be made now. |
It would be a bit weird to pull out just |
For reference fluentui/packages/react-internal/src/components/SearchBox/SearchBox.base.tsx Lines 157 to 176 in 1eff0e0
|
If you can remove it, it allows the commandBar to assign "menuitem" role to the SearchBox when passed in as a commandBar menu item, then it'd resolve the accessibility bug for us. Currently it's blocking us from passing the benchmark test. |
My recommendation would just be to remove The alternative would be to default @smhigley Are you ok with removing the default role=search and letting the role of the container root DIV be definable through |
Removing the default role and letting the app define search landmarks makes sense to me 👍 |
PR is up! |
🎉This issue was addressed in #15450, which has now been successfully released as Handy links: |
🎉This issue was addressed in #15450, which has now been successfully released as Handy links: |
Sounds like this issue has been fixed. Closing. Feel free to reopen if needed. Thanks! |
Environment Information
Describe the issue:
In some cases search box is a part of a larger region with a role 'search'. In this case role of the wrapper for a SearchBox need to be change to 'presentation'. However, setting role attribute on a SearchBox control has no effect, it remains "search" for a wrapper and "searchbox" for input.
Reason is that these roles are hard coded and can not be changed. This is the code from SearchBox.base.tsx
At least it should be possible to change the role of the outer element.
Actual behavior:
Generated HTML for a SearchBox wrapper has a hard coded role of 'searchbox'.
Expected behavior:
Generated HTML for a SearchBox wrapper has a role attribute set as specified, e.g. "presentation".
Priorities and help requested (not applicable if asking question):
Are you willing to submit a PR to fix? (Yes, No)
Yes.
Requested priority: (Blocking, High, Normal, Low)
Normal.
Products/sites affected: (if applicable)
Word WAC.
The text was updated successfully, but these errors were encountered: