-
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
FIX: Use a role="textbox"
for all the Editable elements
#4074
Conversation
role="textbox"
for all the Editable elements
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 do you think about my comment at #3412 (comment) where I suggested maybe TinyMCE ought to be applying these attribute(s) automatically?
blocks/editable/index.js
Outdated
@@ -825,7 +827,7 @@ export default class Editable extends Component { | |||
formatters, | |||
} = this.props; | |||
|
|||
const ariaProps = pickAriaProps( this.props ); | |||
const ariaProps = { ...pickAriaProps( this.props ), 'aria-multiline': MULTI_LINE_TAGS.indexOf( Tagname ) > -1 }; |
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.
Should aria-multiline
be dictated by this.props.multiline
?
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.props.multiline
is undefined for a ParagraphBlock and is set to li
for a ListBlock. I looked at this prop first but it wasn't suitable for this purpose...
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.
Okay. I suspect future maintainers may have a similar reaction to mine in not understanding the difference between how this.props.multiline
and aria-multiline
are handled. Perhaps we could do for a code comment or documentation clarifying this.
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.
I think the best approach would to re-name the multiline prop to something more appropriate, maybe multilineTag
as this is how its used...
@aduth we had some discussion internally believe that it is the responsibility of the tag author to supply its attributes. |
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.
The aria-multiline
attribute is a bit confusing to me. Based on the implementation here, it would make me question why it's not up to the browser or accessible device to infer multiline from a tag name. But then, for how we treat a paragraph block, is it indeed "multiline" ? It can have multiple lines via Shift-Enter, but based on my reading of the aria-multiline
specification, it would seem to be most relevant for describing the plain "Enter" behavior, in which case it's not accurate to say that the paragraph block is multiline, since pressing Enter creates a new separate role="textbox"
element.
blocks/editable/index.js
Outdated
@@ -825,7 +827,7 @@ export default class Editable extends Component { | |||
formatters, | |||
} = this.props; | |||
|
|||
const ariaProps = pickAriaProps( this.props ); | |||
const ariaProps = { ...pickAriaProps( this.props ), 'aria-multiline': MULTI_LINE_TAGS.indexOf( Tagname ) > -1 }; |
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.
Okay. I suspect future maintainers may have a similar reaction to mine in not understanding the difference between how this.props.multiline
and aria-multiline
are handled. Perhaps we could do for a code comment or documentation clarifying this.
@aduth that was my concern after reading the spec. |
@tg-ephox to me VoiceOver, for example, announces: Test: https://codepen.io/afercia/full/goGPPN/ As per the Enter behavior, that's not standard in a textarea and is a bit controversial... since default behaviors should not be altered, ever. |
Any news on this? 🙂 |
Worth noting since 8ae2e80 the paragraph blocks have Even the W3C validator throws an error because of the missing role:
|
809daed
to
9421278
Compare
This issues is required for the merge proposal, thus, I went ahead and updated the PR. Let me know how it looks now @afercia Thanks |
9421278
to
89df64d
Compare
@youknowriad thanks. I've tested extensively, also merging this with the navigation/edit mode #5709 and the role application #5807 to get an idea of how this change improves the screen readers behavior. It's definitely an improvement for all the blocks that can be considered similar to input fields or textareas, e.g.:
because they're really similar to inputs. It is also useful for blocks that are input sunder the hood, for example:
But, we should not set the
We should definitely exclude the list and table blocks, wondering if there's an elegant way to do that. Also wondering about blocks added b plugins, how would they declare if the block editable part needs a |
If it's dependent on the TagName, I can add a rule saying that if the tagName is |
Yes I've seen the tagName thing :) was just wondering if there's a more solid way. Alternatively, this should really be well documented for plugin authors. I'd say the tagName is OK for now? and maybe we can iterate later, if need be. For completeness, also the various captions are OK (cover image, image, gallery, embed, etc.) |
🎉 |
Description
fixes #3412
Whichever node TinyMCE wraps now has
role="textbox"
.aria-multiline="true"
is set for these node types'p', 'ol', 'ul', 'table', 'pre', 'cite'
I'm not 100% sure this is correct for the Paragraph block as Enter or Return will add a new Paragraph, as described here.
How Has This Been Tested?
Visually, inspecting elements for different Blocks
Screenshots (jpeg or gifs if applicable):
Types of changes
Bug fix
Checklist: