-
Notifications
You must be signed in to change notification settings - Fork 34.6k
List: set aria-setsize and aria-posinset #29019
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
Conversation
this.eventBufferer.bufferEvents(() => this.spliceable.splice(start, deleteCount, elements)); | ||
this.eventBufferer.bufferEvents(() => { | ||
this.spliceable.splice(start, deleteCount, elements); | ||
this.view.domNode.setAttribute('aria-setsize', this.length.toString()); |
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.
You should do this outside the event buffering.
Shouldn't there be an initial value for this, before any splice
is called?
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.
Initial value is 0 and I can set it in the constructor.
Ok so I will do it in the method ouside of the buffer
@@ -712,6 +715,7 @@ export class List<T> implements ISpliceable<T>, IDisposable { | |||
setFocus(indexes: number[]): void { | |||
indexes = indexes.sort(numericSort); | |||
this.focus.set(indexes); | |||
this.view.domNode.setAttribute('aria-posinset', indexes.length ? (indexes[0] + 1).toString() : undefined); |
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 w3 docs state:
Authors MUST set the value for aria-posinset to an integer greater than or equal to 1, and less than or equal to the size of the set.
Setting it to undefined
doesn't sound like it's the right thing to do here.
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.
In that case I will jost not set it but remove the attribute, I believe that is the right thing to do
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.
Looks good, you can merge after last changes.
@@ -651,12 +651,16 @@ export class List<T> implements ISpliceable<T>, IDisposable { | |||
if (options.ariaLabel) { | |||
this.view.domNode.setAttribute('aria-label', options.ariaLabel); | |||
} | |||
this.view.domNode.setAttribute('aria-setsize', this.length.toString()); |
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.
Just make this 0
, to be explicit.
|
||
this.style(options); | ||
} | ||
|
||
splice(start: number, deleteCount: number, elements: T[] = []): void { | ||
this.eventBufferer.bufferEvents(() => this.spliceable.splice(start, deleteCount, elements)); | ||
this.eventBufferer.bufferEvents(() => { |
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.
Return this to the old syntax.
Nice! Thank you @isidorn @joaomoreno ! |
Fixes #27900 for the list widget
Please note: that the
splice
seems to be called even when the focus changes in the list so I might be calling setaria-setsize
a bit too often.Also note that
aria-posinset
should start with 1, not 0 thus I am doing +1. More details: https://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset@joaomoreno once you approve on this I can do a similar thing for the tree
@alexandrudima fyi