Skip to content

List: set aria-setsize and aria-posinset - #29019

Merged
Isidor Nikolic (isidorn) merged 3 commits into
masterfrom
isidorn/list-aria-size
Jun 19, 2017
Merged

Isidor Nikolic (isidorn) merged 3 commits into
masterfrom
isidorn/list-aria-size

Conversation

@isidorn

Copy link
Copy Markdown

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

João Moreno (@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
Copy Markdown
Contributor

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
Copy Markdown
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

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
Copy Markdown
Contributor

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
Copy Markdown
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 João Moreno (joaomoreno) left a comment

Copy link
Copy Markdown
Contributor

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.

if (options.ariaLabel) {
this.view.domNode.setAttribute('aria-label', options.ariaLabel);
}
this.view.domNode.setAttribute('aria-setsize', this.length.toString());

Copy link
Copy Markdown
Contributor

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.


splice(start: number, deleteCount: number, elements: T[] = []): void {
this.eventBufferer.bufferEvents(() => this.spliceable.splice(start, deleteCount, elements));
this.eventBufferer.bufferEvents(() => {

Copy link
Copy Markdown
Contributor

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
Isidor Nikolic (isidorn) merged commit dfc46d7 into master Jun 19, 2017
@alexdima

Copy link
Copy Markdown
Member

Nice! Thank you Isidor Nikolic (@isidorn) João Moreno (@joaomoreno) !

@joaomoreno
João Moreno (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