-
Notifications
You must be signed in to change notification settings - Fork 0
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
Accessibility tweaks #15
Conversation
src/vaadin-message-list.js
Outdated
</template> | ||
<ol> | ||
<template is="dom-repeat" items="[[items]]"> | ||
<vaadin-message time="[[item.time]]" user="[[item.user]]">[[item.text]]</vaadin-message> |
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 you have to add <li>
inside the <ol>
for valid html.
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'm not really a fan of complicating our DOM structure with <ol>
and <li>
. I saw the comment that you should avoid role="" if you can do it with the correct native HTML elements, but I still think it brings in more possible issues than what benefits we get for it. Like deeper DOM, and possible unforeseen css rules in different environments. Other components in Vaadin has already used role="list"
and role="listitem"
and we will ensure accessibility compatibility.
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.
@Peppe understandable! I would remove <ol>
then and use <div role=list>
or something else. Looking at the HTML spec using <ol>
without <li>
is a violation: https://www.w3.org/TR/html52/grouping-content.html#the-ol-element
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.
Fixed!
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.
Updated my #14 - looks good!
src/vaadin-message.js
Outdated
@@ -151,7 +153,6 @@ class MessageElement extends ElementMixin(ThemableMixin(PolymerElement)) { | |||
|
|||
ready() { | |||
super.ready(); | |||
this.setAttribute('aria-live', 'polite'); | |||
this.setAttribute('role', 'listitem'); |
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 this should be moved to src/vaadin-message-list.js#87. It would mean that the message-list puts role="listitem" on message. If someone would initialize a message standalone, then there wouldn't be dangling role="listitem", without a parent with role="log".
...and some minor theme related additions (Lumo/Material).