-
Notifications
You must be signed in to change notification settings - Fork 2.6k
ariaDescribedBy prop should render to aria-describedby attribute #1214
Comments
Thanks so much for reporting this. The "Bug Fix Recommendation" would be good to have asap, since it won't affect existing uses of Draft that may be relying on the current behavior. Would you like to take a try at fixing this? I'd also be happy to see the feature implemented as you described, and I'm thinking about how to avoid making it a breaking change in behavior. If the default behavior remained the same when no cc @jessebeach who might have more context/advice |
@basham great catch here.
What about using the ariaDescribedBy prop in lieu of the placeholder id? e.g. (pseudo)
I agree that the order matters with the list of IDs. |
My original feature recommendation was done as a way to give the developer flexibility, fix the bug, and maintain strict backwards compatibility with the current implementation. But in doing so, it creates a clumsy API, and I'm not convinced it would be used or used well. I'm 100% supportive of the simpler solution @jessebeach proposed:
That would be a good compromise between the two solutions I proposed. It solves the issue, while still giving backwards compatibility if @flarnie: I'm unsure when I may have the time to create a PR for this. As in, don't wait on me, if someone else wants to take the lead. |
I think I have some folks at FB interested in working on this soon. :) |
Summary: We have a ariaDescribedBy prop in DraftEditorProps.js but it is not set in DraftEditor. Currently the aria-describedby attribute is set based on if there is a placeholder and is set to the placeholderId. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute issue on github which also has suggested the fix: facebookarchive/draft-js#1214 Reviewed By: jessebeach, flarnie Differential Revision: D6154932 fbshipit-source-id: d828ca5f73921c5d303820c5aed5b39eda08ccd1
Summary: We have a ariaDescribedBy prop in DraftEditorProps.js but it is not set in DraftEditor. Currently the aria-describedby attribute is set based on if there is a placeholder and is set to the placeholderId. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute issue on github which also has suggested the fix: facebookarchive/draft-js#1214 Reviewed By: jessebeach, flarnie Differential Revision: D6154932 fbshipit-source-id: d828ca5f73921c5d303820c5aed5b39eda08ccd1
BUG REPORT (AND POTENTIALLY A FEATURE REQUEST)
The
ariaDescribedBy
prop should render the providedid
string to thearia-describedby
attribute.However, as of Draft
v0.10.1
, it will instead render the placeholder id as the value foraria-describedby
and only if theplaceholder
prop is used.If retaining the current behavior is desired, then at least the
ariaDescribedBy
string should be merged with thethis._placeholderAccessibilityID
string, since the attribute supports multiple id references.Unfortunately, if the Editor merges these ids on behalf of the developer, the developer has no way to control the ordering of these ids. The order matters, because that's the order in which text is announced by a screen reader. And the order will be different in different contexts.
Bug Fix Recommendation: Merge
ariaDescribedBy
prop string before the placeholder id, because that's what the developer is explicitly providing.Feature Recommendation: Consider a future feature in which
ariaDescribedBy
could be a function that provides the placeholder id parameter and returns a string. Such as:If
ariaDescribedBy
is a string, then it renders it as-is, regardless of the presence of theplaceholder
prop.The text was updated successfully, but these errors were encountered: