Tabs - State and A11y errors

未关闭
#705 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@fermarinsanchez 已经在做这个了。

开始于 2025年6月17日。

评估

这个 Issue 还没有评估数据。

描述

a11y bug

Describe the bug

  1. A11y Error: The hardcoded tab-index value at the tabcontent level is causing accessibility issues because it is automatically taking focus when tabbing through the content. Focus delegation should occur at the child level. For example, when there is a list of buttons as children, the focus currently lands on the tabcontent itself on the first tab press, instead of on the first focusable element, which should be the first button.

  2. State Error: The activeKey is not reactive to changes; it always takes the first value on component mount and only responds to clicks. You cannot change the activeKey from outside the component and have it activate the corresponding tab passed via props. The internal state causes the component to take a value only during initialization, and it can only be changed either by forcing a component unmount or through a click event. This behavior is problematic because, in order to achieve the desired functionality, we are forced to unmount the component, which results in losing the scroll position of the tabs, for example.

To Reproduce
Steps to reproduce the behavior:
A11y Error:

  1. Go to Tabs component
  2. Click on tab keyboard
  3. you can see that the content is focus

State Error:

  1. Go to Tabs component
  2. Change the activeKey in code
  3. you can see the selected tab not change

Expected behavior
A11y Error: The tab content should not have a hardcoded tabindex; instead, it should allow its children to control focus behavior.

State Error:We should be able to change the activeKey reactively without having to force a component unmount.

Screenshots
A11y Error:

-Code screenshot:

Image

-Issue screenshot:

Image

Image

State Error:

Image

Desktop (please complete the following information):

  • OS: All
  • Browser All
  • Version All

Smartphone (please complete the following information):

  • Device: All
  • OS: All
  • Browser All
  • Version All

Additional context
Add any other context about the problem here.

git checkout release/1.1.0
git pull
git checkout -b 'fix/tabs-state-a11y'
主要语言
TypeScript
星标
120
派生
6
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Capgemini/dcx-react-library 的其他 Issue

查看 Capgemini/dcx-react-library 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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