From b22e446ce85e8f2c77db669f66dc745cfdb5fb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=B1=AA?= <1844749591@qq.com> Date: Tue, 21 Jan 2025 15:59:25 +0800 Subject: [PATCH 1/4] feat: add role attribute to InternalSegmentedOption for improved accessibility --- src/index.tsx | 1 + tests/__snapshots__/index.test.tsx.snap | 40 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 6b09e9f..8931980 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -147,6 +147,7 @@ const InternalSegmentedOption: React.FC<{ segmentedClassNames?.label, )} title={title} + role="option" aria-selected={checked} style={styles?.label} > diff --git a/tests/__snapshots__/index.test.tsx.snap b/tests/__snapshots__/index.test.tsx.snap index cba0121..8c3d99f 100644 --- a/tests/__snapshots__/index.test.tsx.snap +++ b/tests/__snapshots__/index.test.tsx.snap @@ -34,6 +34,7 @@ exports[`rc-segmented render label with ReactNode 1`] = `