Skip to content

Commit 35a2e76

Browse files
committed
docs(ui-select,ui-tag): add clarification about the usage of accessible dismissable tags
Closes: INSTUI-4335
1 parent de22f76 commit 35a2e76

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

packages/ui-select/src/Select/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ It's best practice to always provide autocomplete functionality to help users ma
681681

682682
#### Highlighting and selecting options
683683

684-
To mark an option as "highlighted", use the option's `isHighlighted` prop. Note that only one highlighted option is permitted. Similarly, use `isSelected` to mark an option or multiple options as "selected". When allowing multiple selections, it's best to render a [Tag](#Tag) for each selected option via the `renderBeforeInput` prop.
684+
To mark an option as "highlighted", use the option's `isHighlighted` prop. Note that only one highlighted option is permitted. Similarly, use `isSelected` to mark an option or multiple options as "selected". When allowing multiple selections, it's best to render a [Tag](#Tag) with [AccessibleContent](#AccessibleContent) for each selected option via the `renderBeforeInput` prop.
685685

686686
- ```javascript
687687
class MultipleSelectExample extends React.Component {
@@ -845,8 +845,11 @@ To mark an option as "highlighted", use the option's `isHighlighted` prop. Note
845845
<Tag
846846
dismissible
847847
key={id}
848-
title={`Remove ${this.getOptionById(id).label}`}
849-
text={this.getOptionById(id).label}
848+
text={
849+
<AccessibleContent alt={`Remove ${this.getOptionById(id).label}`}>
850+
{this.getOptionById(id).label}
851+
</AccessibleContent>
852+
}
850853
margin={index > 0 ? 'xxx-small 0 xxx-small xx-small' : 'xxx-small 0'}
851854
onClick={(e) => this.dismissTag(e, id)}
852855
/>
@@ -1071,8 +1074,11 @@ To mark an option as "highlighted", use the option's `isHighlighted` prop. Note
10711074
<Tag
10721075
dismissible
10731076
key={id}
1074-
title={`Remove ${getOptionById(id).label}`}
1075-
text={getOptionById(id).label}
1077+
text={
1078+
<AccessibleContent alt={`Remove ${this.getOptionById(id).label}`}>
1079+
{this.getOptionById(id).label}
1080+
</AccessibleContent>
1081+
}
10761082
margin={index > 0 ? 'xxx-small 0 xxx-small xx-small' : 'xxx-small 0'}
10771083
onClick={(e) => dismissTag(e, id)}
10781084
/>

packages/ui-tag/src/Tag/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: example
1515

1616
When the `dismissible` prop is added to a clickable Tag, the button
1717
renders an X/close icon (the Tag should be dismissed via the `onClick`
18-
prop).
18+
prop). When implementing dismissable tags, be sure to add [AccessibleContent](#AccessibleContent) to clarify that the tag is dismissible to screen readers.
1919

2020
```js
2121
---

packages/ui-tag/src/Tag/props.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ import type {
4242
type TagOwnProps = {
4343
className?: string
4444
text: string | React.ReactNode
45+
/**
46+
* @deprecated since version 10
47+
* Use of the title attribute is highly problematic due to accessibility concerns
48+
*/
4549
title?: string
4650
/**
4751
* Whether or not to disable the tag

0 commit comments

Comments
 (0)