Skip to content

Commit 70524bd

Browse files
authored
[docs] Add demo aria labels (#5084)
1 parent 06799a2 commit 70524bd

14 files changed

Lines changed: 21 additions & 15 deletions

File tree

docs/scripts/generateLlmTxt/__snapshots__/mdxToMarkdown.test.mjs.snap

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,10 @@ export default function ExampleDirectionProvider() {
977977
<Slider.Control className="flex w-56 touch-none items-center py-3 select-none">
978978
<Slider.Track className="h-1 w-full bg-neutral-200 select-none dark:bg-neutral-800">
979979
<Slider.Indicator className="bg-neutral-950 select-none dark:bg-white" />
980-
<Slider.Thumb className="size-4 border border-neutral-950 bg-white select-none has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-neutral-950 dark:has-[:focus-visible]:outline-white dark:border-white dark:bg-neutral-950" />
980+
<Slider.Thumb
981+
aria-label="Volume"
982+
className="size-4 border border-neutral-950 bg-white select-none has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-neutral-950 dark:has-[:focus-visible]:outline-white dark:border-white dark:bg-neutral-950"
983+
/>
981984
</Slider.Track>
982985
</Slider.Control>
983986
</Slider.Root>
@@ -1067,7 +1070,7 @@ export default function ExampleDirectionProvider() {
10671070
<Slider.Control className={styles.Control}>
10681071
<Slider.Track className={styles.Track}>
10691072
<Slider.Indicator className={styles.Indicator} />
1070-
<Slider.Thumb className={styles.Thumb} />
1073+
<Slider.Thumb aria-label="Volume" className={styles.Thumb} />
10711074
</Slider.Track>
10721075
</Slider.Control>
10731076
</Slider.Root>

docs/src/app/(docs)/react/components/otp-field/demos/alphanumeric/css-modules/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function OTPFieldAlphanumericDemo() {
2424
<OTPField.Input
2525
key={index}
2626
className={styles.Input}
27-
aria-label={`Character ${index + 1} of ${CODE_LENGTH}`}
27+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${CODE_LENGTH}`}
2828
/>
2929
))}
3030
</OTPField.Root>

docs/src/app/(docs)/react/components/otp-field/demos/alphanumeric/tailwind/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function OTPFieldAlphanumericDemo() {
2323
<OTPField.Input
2424
key={index}
2525
className="m-0 h-10 w-10 rounded-none border border-neutral-950 bg-white dark:bg-neutral-950 text-center font-inherit text-base font-normal text-neutral-950 focus:outline-2 focus:-outline-offset-1 focus:outline-neutral-950 dark:focus:outline-white dark:border-white dark:text-white"
26-
aria-label={`Character ${index + 1} of ${CODE_LENGTH}`}
26+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${CODE_LENGTH}`}
2727
/>
2828
))}
2929
</OTPField.Root>

docs/src/app/(docs)/react/components/otp-field/demos/custom-sanitize/css-modules/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function OTPFieldCustomNormalizeDemo() {
5656
<OTPField.Input
5757
key={index}
5858
className={`${styles.Input} ${activeInvalidIndex === index ? invalidClassName : ''}`.trim()}
59-
aria-label={`Character ${index + 1} of ${CODE_LENGTH}`}
59+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${CODE_LENGTH}`}
6060
onFocus={() => {
6161
setFocusedIndex(index);
6262
}}

docs/src/app/(docs)/react/components/otp-field/demos/focused-placeholder/css-modules/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function OTPFieldFocusedPlaceholderDemo() {
2424
key={index}
2525
className={styles.Input}
2626
placeholder="•"
27-
aria-label={`Character ${index + 1} of ${CODE_LENGTH}`}
27+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${CODE_LENGTH}`}
2828
/>
2929
))}
3030
</OTPField.Root>

docs/src/app/(docs)/react/components/otp-field/demos/focused-placeholder/tailwind/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function OTPFieldFocusedPlaceholderDemo() {
2323
key={index}
2424
className="m-0 h-10 w-10 rounded-none border border-neutral-950 bg-white dark:bg-neutral-950 text-center font-inherit text-base font-normal text-neutral-950 placeholder:text-neutral-500 focus:outline-2 focus:-outline-offset-1 focus:outline-neutral-950 dark:focus:outline-white focus:placeholder:text-transparent dark:border-white dark:text-white dark:placeholder:text-neutral-400"
2525
placeholder="•"
26-
aria-label={`Character ${index + 1} of ${CODE_LENGTH}`}
26+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${CODE_LENGTH}`}
2727
/>
2828
))}
2929
</OTPField.Root>

docs/src/app/(docs)/react/components/otp-field/demos/grouped/css-modules/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function OTPFieldGroupedDemo() {
1818
<OTPField.Input
1919
key={index}
2020
className={styles.Input}
21-
aria-label={`Character ${index + 1} of ${OTP_LENGTH}`}
21+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${OTP_LENGTH}`}
2222
/>
2323
))}
2424
</div>

docs/src/app/(docs)/react/components/otp-field/demos/grouped/tailwind/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function OTPFieldGroupedDemo() {
1717
<OTPField.Input
1818
key={index}
1919
className="m-0 h-10 w-10 rounded-none border border-neutral-950 bg-white dark:bg-neutral-950 text-center font-inherit text-base font-normal text-neutral-950 focus:outline-2 focus:-outline-offset-1 focus:outline-neutral-950 dark:focus:outline-white dark:border-white dark:text-white"
20-
aria-label={`Character ${index + 1} of ${OTP_LENGTH}`}
20+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${OTP_LENGTH}`}
2121
/>
2222
))}
2323
</div>

docs/src/app/(docs)/react/components/otp-field/demos/hero/css-modules/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function ExampleOTPField() {
2323
<OTPField.Input
2424
key={index}
2525
className={styles.Input}
26-
aria-label={`Character ${index + 1} of ${OTP_LENGTH}`}
26+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${OTP_LENGTH}`}
2727
/>
2828
))}
2929
</OTPField.Root>

docs/src/app/(docs)/react/components/otp-field/demos/hero/tailwind/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function ExampleOTPField() {
2222
<OTPField.Input
2323
key={index}
2424
className="m-0 h-10 w-10 rounded-none border border-neutral-950 bg-white dark:bg-neutral-950 text-center font-inherit text-base font-normal text-neutral-950 focus:outline-2 focus:-outline-offset-1 focus:outline-neutral-950 dark:focus:outline-white dark:border-white dark:text-white"
25-
aria-label={`Character ${index + 1} of ${OTP_LENGTH}`}
25+
aria-label={index === 0 ? undefined : `Character ${index + 1} of ${OTP_LENGTH}`}
2626
/>
2727
))}
2828
</OTPField.Root>

0 commit comments

Comments
 (0)