带有 *ngFor ARIA 标签的 Angular Material mat-option 在 Lighthouse 失败

标签 angular drop-down-menu angular-material wai-aria

我想知道是否有人遇到过同样的问题。

 <mat-select formControlName="tag" aria-label="Select a Tag">
  <mat-option *ngFor="let tag of tags"
                      [value]="tag"
                      role="option">
            {{tag | translate}}
  </mat-option>
 </mat-select>

此代码实际上在 处失败灯塔审计报告原因如下:

Elements with an ARIA [role] that require children to contain a specific [role] are missing some or all of those required children



有没有人设法解决这样的问题?我很想看到一些解决方案或技巧来避免 Lighthouse 失败。

提前致谢

最佳答案

似乎一切正常,但根据此评论,灯塔定位错误:
https://github.com/angular/components/issues/21354
正如@CrisBelto 所说

This is working as expected and accessibility checking tools haven't been updated to account for the new pattern. See the discussion after #20082 (comment).

关于带有 *ngFor ARIA 标签的 Angular Material mat-option 在 Lighthouse 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61302490/

相关文章:

drop-down-menu - DropDownMenuItem 在 Android jetpack compose 中无法正常工作

css - 下拉菜单水平而不是垂直

css - 如何将自定义 CSS 应用于 Angular Material md-contact-chips

angularjs - 创建一个像 AngularJs Material 网站一样的菜单

Angular 4 错误 "Expected 2-3 arguments, but got 1"

angular - Angular 4/2 中的方法重载

javascript - LAMP 堆栈中的 Angular 2

JQuery 下拉菜单鼠标悬停。菜单关闭

angular-material - 角 Material md-tab 标签大写/小写

linux - angular2 项目在 Firefox 上加载时 websocket 中断