formatGroupLabel returns string but not used that way in documentation #4407
Labels
category/accessibility
Issues or PRs related to accessibility
category/documentation
Issues or PRs about documentation or the website itself
issue/needs-review
Perhaps a breaking change for some so wanted to document it with a possibility to discuss/resolve this later.
Given these props, there are different expectations about the return type.
getOptionLabel
=> stringgetOptionValue
=> stringformatOptionLabel
=> react.NodeformatGroupLabel
=> stringThe nomenclature suggests that
formatGroupLabel
would likely be expected to render areact Node
as well, but instead it is defined to return a string. I say likely expected because the first grouping example on the homepage of the documentation misuses this prop in this exact way.While it might not be a big deal to some, misusing these props has an impact on accessibility as it is reliant to relay the label back to the screen reader and will instead return "object object" as the selected option.
Recommendations:
group
as a possible context forformatOptionLabel
to consolidate the render functions there.getOptionLabel
andformatGroupLabel
formatGroupLabel
togetGroupLabel
in a future major release.I could create a PR, but wanted to get thoughts on listed considerations before moving forward
Let it also be noted that the accessibility concerns around the current stringification has been noted here: #4134
The text was updated successfully, but these errors were encountered: