Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit b8a1a58

Browse files
Shi Shucopybara-github
authored andcommitted
fix(tooltip): Change foundation to check for "dialog" on the anchor element's aria-haspopup attribute instead of checking for "true".
PiperOrigin-RevId: 351157093
1 parent 1631198 commit b8a1a58

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/mdc-tooltip/foundation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class MDCTooltipFoundation extends MDCFoundation<MDCTooltipAdapter> {
142142
this.adapter.getAttribute(attributes.PERSISTENT) === 'true';
143143
this.interactiveTooltip =
144144
!!this.adapter.getAnchorAttribute(attributes.ARIA_EXPANDED) &&
145-
this.adapter.getAnchorAttribute(attributes.ARIA_HASPOPUP) === 'true';
145+
this.adapter.getAnchorAttribute(attributes.ARIA_HASPOPUP) === 'dialog';
146146
}
147147

148148
isShown() {

packages/mdc-tooltip/test/component.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ describe('MDCTooltip', () => {
297297
describe('default interactive rich tooltip tests', () => {
298298
beforeEach(() => {
299299
fixture = getFixture(`<div>
300-
<button aria-describedby="tt0" aria-haspopup="true" aria-expanded="false">
300+
<button aria-describedby="tt0" aria-haspopup="dialog" aria-expanded="false">
301301
anchor
302302
</button>
303303
<div id="tt0" class="mdc-tooltip mdc-tooltip--rich" aria-hidden="true" role="dialog">

packages/mdc-tooltip/test/foundation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function setUpFoundationTestForRichTooltip(
100100
mockAdapter.getAnchorAttribute.withArgs(attributes.ARIA_EXPANDED)
101101
.and.returnValue(isInteractive ? 'false' : null);
102102
mockAdapter.getAnchorAttribute.withArgs(attributes.ARIA_HASPOPUP)
103-
.and.returnValue(isInteractive ? 'true' : 'false');
103+
.and.returnValue(isInteractive ? 'dialog' : 'false');
104104
foundation.init();
105105

106106
return {foundation, mockAdapter};

0 commit comments

Comments
 (0)