我想知道是否有人遇到过同样的问题。
<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/