angular / angular/components

bug(Table): Tab navigation on inputs inside table with sticky columns (focus out of sight)

未关闭
#28,004 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
Accessibility area: cdk/table area: material/table P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

When having multiple inputs on one row, one input per cell, inside a table with one or more sticky columns the TAB key navigation is focusing at some point on an input that is hidden under the sticky columns, making the focus out of sight, but still inside the table.

The current behavior it's not compliant with the latest accessibility guidelines (WCAG) that states that an element that is focused needs to be in sight. (ref link: https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum)

### Reproduction

StackBlitz link:
https://stackblitz.com/edit/r22tvc?file=src%2Fexample%2Ftable-sticky-complex-flex-example.html

Table state:
- have horizontal scroll (requires a higher number of columns)
- one or more columns sticky
- on at least one row have an input on each cell

Steps to reproduce:
1. Scroll the table in order to hide some columns under the sticky columns
2. Focus first inside the first cell of the row with the inputs
3. Press TAB key in order to navigate through the inputs
4. The focus at some point is on the input that is hidden under the sticky columns

### Expected Behavior

The focused element should be in sight, visible, not hidden under the sticky columns.

### Actual Behavior

The focus is hidden under the sticky columns, out of sight.

DEMO:
![table_TAB_focus](https://github.com/angular/components/assets/26005241/58a91a07-5b04-41c3-a54c-f1ccda6b9b8c)

### Environment

- Angular: 16.1.1
- CDK/Material: 16.2.9
- Browser(s): Chrome (118.0.5993.89) / Firefix (119.0)
- Operating System (e.g. Windows, macOS, Ubuntu): Windows x64

贡献指南

打开贡献指南

调研方向

从 src/example/table-sticky-complex-flex-example.html 中的 StackBlitz 复现开始,并使用水平滚动、sticky 列和同一行中的 input 复现该问题。通过使用 Tab 键遍历每个 input,并确认获得焦点的元素仍然可见而不会被 sticky 列遮挡,来验证修复效果。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
accessibility, frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。