angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.34k stars 6.74k forks source link

bug(Material Stepper): Certain ARIA roles must contain particular children Error #26444

Open crumbyshirt opened 1 year ago

crumbyshirt commented 1 year ago

Is this a regression?

The previous version in which this bug was not present was

No response

Description

The documentation for the stepper appears to indicate that this should not be occurring based on the role for the stepper being a tablist and the roles for steps being tab. I think the problem comes from some interim nodes between the tabs and the tablist.

Reproduction

Steps to reproduce:

  1. navigate to the material stepper examples page: https://rc.material.angular.io/components/stepper/examples
  2. run a scan of it using the axe def tool chrome extension: https://chrome.google.com/webstore/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US
  3. You will see that it will result in 14 instances of the error "Certain ARIA roles must contain particular children". That is one for each stepper on the example page.

Expected Behavior

Running the WCAG2.1 AA compliance scan should not find the "Certain ARIA roles must contain particular children" issue which is considered a critical aria issue.

Actual Behavior

Running the WCAG2.1 AA compliance scan finds the "Certain ARIA roles must contain particular children" issue which is considered a critical aria issue.

There is no clear way to resolve this issue with the stepper component.

Environment

crisbeto commented 1 year ago

I looked into this one. Fixing it for a horizontal stepper is straightforward since we just need to move the role to a different element, but it'll be difficult to fix for a vertical one, because the tabs and tab labels have to be siblings. That being said, I don't think that this affects users.

JimAgwit commented 9 months ago

@crisbeto What do you mean when you say 'move the role to a different element'. You mean on your side when the update is done or ill put it manually.

Heres my html:

<mat-horizontal-stepper linear #stepper labelPosition="bottom" (selectionChange)="onStepChange($event)">
 <ng-template matStepperIcon="edit" let-index="index">
        {{index + 1}}
      </ng-template>
      <ng-template matStepperIcon="done" let-index="index">
        {{index + 1}}
      </ng-template>
      <ng-template matStepperIcon="number" let-index="index">
        {{index + 1}}
      </ng-template>

 <mat-step  [stepControl]="sample.control" [editable]="!isSaving">
</mat-step>
<mat-step role="tab" [stepControl]="sample.control" [editable]="!isSaving">
</mat-step>
 <mat-step role="tab" [stepControl]="sample.control" [editable]="!isSaving">
</mat-step>
 <mat-step role="tab" [editable]="!isSaving">
</mat-step>
    </mat-horizontal-stepper>
vandents commented 4 months ago

I second what @JimAgwit said. @crisbeto Which element has its role moved, and to which element is the role moved to? Thanks in advance.