MCPcopy Create free account
hub / github.com/react-component/select / Polite

Function Polite

src/BaseSelect/Polite.tsx:9–32  ·  view source on GitHub ↗
(props: PoliteProps)

Source from the content-addressed store, hash-verified

7}
8
9export default function Polite(props: PoliteProps) {
10 const { visible, values } = props;
11
12 if (!visible) {
13 return null;
14 }
15
16 // Only cut part of values since it's a screen reader
17 const MAX_COUNT = 50;
18
19 return (
20 <span
21 aria-live="polite"
22 style={{ width: 0, height: 0, position: 'absolute', overflow: 'hidden', opacity: 0 }}
23 >
24 {/* Merge into one string to make screen reader work as expect */}
25 {`${values
26 .slice(0, MAX_COUNT)
27 .map(({ label, value }) => (['number', 'string'].includes(typeof label) ? label : value))
28 .join(', ')}`}
29 {values.length > MAX_COUNT ? ', ...' : null}
30 </span>
31 );
32}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…