The Screen Reader Only component should be used to visually hide content that is necessary to provide appropriate context to users who experience a page using assistive technology.
When wrapped with the Screen Reader Only component, content is visually hidden but still available to assistive technology. This can be useful when information or relationships between UI controls are only communicated visually. By being able to visually hide some content you are able to provide clarifying information to non-sighted users without adding redundancy to the visual design.
All sectioning elements, such as Cards, should contain a heading to provide a clear document outline and form of navigation to assistive technology users. However, there may be times a heading is not required (or even redundant) in a particular UI for sighted users. By using the Screen Reader Only component you can provide a visually hidden heading to give additional context and hierarchy. In the example below, we've added "Flex" as a heading that is accessible to assistive technology, but hidden visually.
<Card><ScreenReaderOnly as="div"><Heading as="h2" variant="heading20">Flex</Heading></ScreenReaderOnly><Paragraph>Deploy an omnichannel contact center within minutes and customize every element of the experience, including the agent desktop, channels, interaction routing, and reporting using common web frameworks like React.js and REST APIs.</Paragraph><Flex vAlignContent="center"><Flex marginRight="space40"><Button variant="primary">Launch Flex</Button></Flex><Anchor href="#">View all projects</Anchor></Flex></Card>
Each column in a table is required to have a column header. Sometimes those column headers can be visually hidden from sighted users if desired. To do so use the Screen Reader Only component to hide the cell content for that column header.
Another common use case is for providing correct context to repetitive actions. In the example below, the "Buy" button is clearly visually associated with the phone number via row highlighting. However, to a screen reader user, this association may not be as clear. To provide additional clarification we can add what you would be buying (Buy ) as visually hidden text to the button. This way, we can keep the same level of context for all users.
<Table><THead><Tr><Th>Number</Th><Th>Type</Th><Th>Monthly Fee</Th><Th><ScreenReaderOnly>Actions</ScreenReaderOnly></Th></Tr></THead><TBody><Tr><Th><strong>+1 (903) 603-9469</strong><Text as="div" color="colorTextWeak" fontWeight="normal">Mabank, TX</Text></Th><Td>local</Td><Td>$1.00</Td><Td><Button variant="secondary" size="small">Buy <ScreenReaderOnly>+1 (903) 603-9469</ScreenReaderOnly></Button></Td></Tr><Tr><Th><strong>+1 (470) 309-0026</strong><Text as="div" color="colorTextWeak" fontWeight="normal">Adairsville, GA</Text></Th><Td>local</Td><Td>$1.00</Td><Td><Button variant="secondary" size="small">Buy <ScreenReaderOnly>+1 (470) 309-0026</ScreenReaderOnly></Button></Td></Tr><Tr><Th><strong>+1 (484) 662-4088</strong><Text as="div" color="colorTextWeak" fontWeight="normal">Hamburg, PA</Text></Th><Td>local</Td><Td>$1.00</Td><Td><Button variant="secondary" size="small">Buy <ScreenReaderOnly>+1 (484) 662-4088</ScreenReaderOnly></Button></Td></Tr></TBody></Table>
Use the Screen Reader Only component when you are required to provide additional or contextual information to a screen reader user which a sighted user maybe able to infer and when you cannot do so via semantic HTML.
Do
Use to provide additional text content to users of assistive technology
Don't
Don't use to hide interactive content