Skip to content

Commit 18a3e44

Browse files
committed
chore(ui-color-picker): remove aria-describedby
1 parent 7518383 commit 18a3e44

File tree

1 file changed

+22
-6
lines changed
  • packages/ui-color-picker/src/ColorPreset

1 file changed

+22
-6
lines changed

packages/ui-color-picker/src/ColorPreset/index.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
266266
cursor={this.props.disabled ? 'not-allowed' : 'auto'}
267267
as="button"
268268
{...(selectOnClick ? { onClick: () => this.props.onSelect(color) } : {})}
269-
{...(this.isSelectedColor(color)
270-
? { 'aria-label': color + ' selected' }
271-
: { 'aria-label': color })}
269+
{...{
270+
'aria-label': `${color}${
271+
this.isSelectedColor(color) ? ' selected' : ''
272+
}`
273+
}}
272274
>
273275
<div>
274276
<ColorIndicator color={color} shape="rectangle" role="presentation" />
@@ -284,9 +286,23 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
284286
</View>
285287
)
286288

287-
renderIndicatorTooltip = (child: React.ReactElement, color: string) => (
288-
<Tooltip renderTip={<div>{color}</div>}>{child}</Tooltip>
289-
)
289+
renderIndicatorTooltip = (child: React.ReactElement, color: string) => {
290+
return (
291+
<Tooltip
292+
renderTip={<div>{color}</div>}
293+
elementRef={(element) => {
294+
if (
295+
element &&
296+
element.firstElementChild instanceof HTMLButtonElement
297+
) {
298+
element.firstElementChild.removeAttribute('aria-describedby')
299+
}
300+
}}
301+
>
302+
{child}
303+
</Tooltip>
304+
)
305+
}
290306

291307
renderSettingsMenu = (color: string, index: number) => (
292308
<Drilldown

0 commit comments

Comments
 (0)