From 1b6c7248b06aa82c0bdc498a73caca09e46d91f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=B3=E5=BB=B7=E5=AE=89?=
<73953029+nrps9909@users.noreply.github.com>
Date: Thu, 27 Aug 2026 04:09:14 +0800
Subject: [PATCH 1/3] fix: expose accessible progress semantics
---
README.md | 15 +++++++++++++++
README.zh-CN.md | 15 +++++++++++++++
src/Line.tsx | 1 +
src/interface.ts | 2 +-
tests/__snapshots__/index.spec.js.snap | 5 +++++
tests/semantic.spec.tsx | 26 +++++++++++++++++++++++++-
6 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 5894fd2..fff0445 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,19 @@ export default () => (
);
```
+The SVG is decorative by default. When using it as the progress indicator itself, provide progress semantics and an accessible name with standard SVG/ARIA props:
+
+```tsx | pure
+
+```
+
## Examples
Run the local dumi site:
@@ -88,6 +101,8 @@ Then open `http://localhost:8000`.
| `styles` | Partial> | - | Semantic styles for internal slots. |
| `transition` | string | - | CSS transition for track updates. |
+Standard SVG attributes, including `role` and `aria-*`, are forwarded to the root SVG.
+
## Development
```bash
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 83a06d9..7cfa887 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -52,6 +52,19 @@ export default () => (
);
```
+SVG 默认作为装饰元素。当 SVG 本身作为进度指示器时,可通过标准 SVG/ARIA 属性提供进度语义和无障碍名称:
+
+```tsx | pure
+
+```
+
## 示例
运行本地 dumi 站点:
@@ -88,6 +101,8 @@ npm start
| `styles` | Partial> | - | 内部插槽的语义化样式。 |
| `transition` | string | - | 用于跟踪更新的 CSS 过渡。 |
+标准 SVG 属性(包括 `role` 和 `aria-*`)会透传到根 SVG。
+
## 本地开发
```bash
diff --git a/src/Line.tsx b/src/Line.tsx
index 39a9b59..3fcbb99 100644
--- a/src/Line.tsx
+++ b/src/Line.tsx
@@ -54,6 +54,7 @@ const Line: React.FC = (props) => {
viewBox={viewBoxString}
preserveAspectRatio="none"
style={style}
+ role="presentation"
{...restProps}
>
{
id?: string;
strokeWidth?: number;
railWidth?: number;
diff --git a/tests/__snapshots__/index.spec.js.snap b/tests/__snapshots__/index.spec.js.snap
index d854fc7..b566b25 100644
--- a/tests/__snapshots__/index.spec.js.snap
+++ b/tests/__snapshots__/index.spec.js.snap
@@ -321,6 +321,7 @@ exports[`Progress Diff Line should match snapshot 1`] = `