Skip to content

Commit 0057bea

Browse files
committed
fix(ui-tooltip,ui-popover): put aria-expanded on trigger element
INSTUI-4544
1 parent 8f8793a commit 0057bea

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

packages/ui-popover/src/Popover/index.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class Popover extends Component<PopoverProps, PopoverState> {
437437
let trigger = this._renderTrigger
438438

439439
if (trigger) {
440-
const { on, shouldContainFocus } = this.props
440+
const { on } = this.props
441441

442442
let onClick: React.MouseEventHandler | undefined = undefined
443443
let onFocus: React.FocusEventHandler | undefined = undefined
@@ -468,17 +468,13 @@ class Popover extends Component<PopoverProps, PopoverState> {
468468
}
469469
}
470470

471-
if (shouldContainFocus) {
472-
// only set aria-expanded if popover can contain focus
473-
expanded = this.shown ? 'true' : 'false'
471+
// only set aria-expanded if popover can contain focus
472+
expanded = this.shown ? 'true' : 'false'
474473

475-
if ('aria-expanded' in this.props) {
476-
// @ts-expect-error It is an escape hatch, in case someone
477-
// wants to remove/override aria-expanded even when shouldContainFocus
478-
expanded = this.props['aria-expanded']
479-
}
480-
} else {
481-
expanded = undefined
474+
if ('aria-expanded' in this.props) {
475+
// @ts-expect-error It is an escape hatch, in case someone
476+
// wants to remove/override aria-expanded even when shouldContainFocus
477+
expanded = this.props['aria-expanded']
482478
}
483479

484480
trigger = safeCloneElement(trigger, {

packages/ui-tooltip/src/Tooltip/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class Tooltip extends Component<TooltipProps, TooltipState> {
177177
elementRef={this.handleRef}
178178
shouldCloseOnDocumentClick={false}
179179
shouldCloseOnEscape
180+
aria-expanded={undefined}
180181
>
181182
{!preventTooltip ? (
182183
<span id={this._id} css={styles?.tooltip} role="tooltip">

0 commit comments

Comments
 (0)