Skip to content
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

igx-carousel accessibility improvements #8864

Merged
merged 21 commits into from
Feb 1, 2021
Merged

Conversation

ddincheva
Copy link
Contributor

Closes #8202

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@ddincheva ddincheva added 🎠 carousel 🛠️ status: in-development Issues and PRs with active development on them ♿ a11y When the issue or PR is related to accessibility version: 11.1.x labels Jan 28, 2021
kdinev
kdinev previously approved these changes Jan 28, 2021
@ddincheva ddincheva added ❌ status: awaiting-test PRs awaiting manual verification and removed 🛠️ status: in-development Issues and PRs with active development on them labels Jan 29, 2021
<div *ngFor="let slide of slides"
class="igx-carousel-indicators__indicator"
(click)="select(slide)"
[id]="setId(slide)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a getter instead of a method for the attributes. Same is applicable to attr.aria-label. You can host bind from within the component also with a getter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you that there is no need to use a method here, but I can not use a getter because the id and the labels that are constructed depends on the slide index and I can not pass a parameter to a getter, but maybe is better here to just construct the string literal directly in the template ... I don't see any benefit in using a function for that simple purpose. I can no use a host binding because tab elements are not in a separated component, they are part of the carousel component template.


/** @hidden */
@HostBinding('attr.aria-labelledby')
public labelId = `igxCarouselLbl`; // tab-${this.current + 1}-3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be static?

Copy link
Contributor

@zdrawku zdrawku Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something that we discussed while she was addressing some in-progress stuff, this will become:

public labelId = `${this.id}-label`;

the template will be updated accordingly

public roleDescription = 'carousel';

/** @hidden */
@HostBinding('attr.aria-labelledby')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set this aria attr only when the label is visible - which is happening when the total slides are more than the maximumIndicatorsCount (5)

@zdrawku zdrawku requested a review from kdinev February 1, 2021 13:13
@zdrawku zdrawku added 💥 status: in-test PRs currently being tested and removed ❌ status: awaiting-test PRs awaiting manual verification labels Feb 1, 2021
* ```
*
*/
@HostBinding('attr.aria-selected')
public get ariaLive() {
return this.active ? 'polite' : null;
public get ariaSelected(): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the aria-selected error of the slide element, it appears that when aria-selected is used, its controlled tabpanel should have its aria-expanded attribute set to true and its hidden attribute set to false, otherwise the reverse.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-selected attribute should be added only to the element with role 'tab'. 'tabpanel' element should not have such an attribute /aria tabpanel spec/.. so I just removed it

@zdrawku zdrawku added ✅ status: verified Applies to PRs that have passed manual verification and removed 💥 status: in-test PRs currently being tested labels Feb 1, 2021
@zdrawku zdrawku merged commit b2db307 into master Feb 1, 2021
@zdrawku zdrawku deleted the ddincheva/carouselAria branch February 1, 2021 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎠 carousel version: 11.1.x ♿ a11y When the issue or PR is related to accessibility ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

igx-carousel accessibility improvements
3 participants