Skip to content

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

Merged
merged 3 commits into from
Jun 19, 2017
Merged

Conversation

isidorn
Copy link
Collaborator

@isidorn isidorn commented Jun 19, 2017

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 set aria-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

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());
Copy link
Member

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?

Copy link
Collaborator Author

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);
Copy link
Member

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.

Copy link
Collaborator Author

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

@joaomoreno joaomoreno added this to the June 2017 milestone Jun 19, 2017
Copy link
Member

@joaomoreno joaomoreno left a 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());
Copy link
Member

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(() => {
Copy link
Member

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.

@isidorn isidorn merged commit dfc46d7 into master Jun 19, 2017
@alexdima
Copy link
Member

Nice! Thank you @isidorn @joaomoreno !

@joaomoreno joaomoreno deleted the isidorn/list-aria-size branch June 20, 2017 10:07
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree: set aria-setsize and aria-posinset
4 participants