Skip to content

Commit

Permalink
fix(ui-color-picker): make ColorPicker tooltip VoiceOver focusable
Browse files Browse the repository at this point in the history
Closes: INSTUI-4259
  • Loading branch information
balzss committed Nov 29, 2024
1 parent c871244 commit 610c0d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 14 additions & 4 deletions packages/ui-color-picker/src/ColorPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/** @jsxFrag React.Fragment */
import React, { Component } from 'react'

import { withStyle, jsx } from '@instructure/emotion'
import { withStyle, jsx, InstUISettingsProvider } from '@instructure/emotion'
import { warn, error } from '@instructure/console'
import { omitProps } from '@instructure/ui-react-utils'
import { testable } from '@instructure/ui-testable'
Expand Down Expand Up @@ -389,9 +389,19 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
<span>
<span css={styles?.label}>{label}</span>
<span>
<Tooltip renderTip={tooltip}>
<IconInfoLine tabIndex={-1} />
</Tooltip>
<InstUISettingsProvider
theme={{
componentOverrides: {
BaseButton: {
smallHeight: 'auto'
}
}
}}
>
<Tooltip renderTip={<span aria-hidden={true}>{tooltip}</span>}>
<IconButton withBackground={false} withBorder={false} screenReaderLabel={tooltip} size="small" shape="circle" width="auto" renderIcon={IconInfoLine}/>
</Tooltip>
</InstUISettingsProvider>
</span>
</span>
) : (
Expand Down
7 changes: 3 additions & 4 deletions packages/ui-svg-images/src/InlineSVG/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ class InlineSVG extends Component<InlineSVGProps> {
}

get labelledBy() {
const ids = []
const ids: string[] = []

if (this.props.title) {
ids.push(this.titleId)
ids.push(this.titleId as string)
}

if (this.props.description) {
ids.push(this.descId)
ids.push(this.descId as string)
}

return ids.length > 0 ? ids.join(' ') : undefined
Expand All @@ -150,7 +150,6 @@ class InlineSVG extends Component<InlineSVGProps> {
title,
description,
focusable,
children,
src,
styles,
...props
Expand Down

0 comments on commit 610c0d8

Please sign in to comment.