diff --git a/packages/ui/components/overlays/src/OverlayController.js b/packages/ui/components/overlays/src/OverlayController.js index 9b1b7b9a5..99991fd27 100644 --- a/packages/ui/components/overlays/src/OverlayController.js +++ b/packages/ui/components/overlays/src/OverlayController.js @@ -640,7 +640,7 @@ export class OverlayController extends EventTarget { __setupTeardownAccessibility({ phase }) { if (phase === 'init') { this.__storeOriginalAttrs(this.contentNode, ['role', 'id']); - const isModal = this.hasBackdrop; + const isModal = this.trapsKeyboardFocus; if (this.invokerNode) { const attributesToStore = ['aria-labelledby', 'aria-describedby']; @@ -1300,7 +1300,7 @@ export class OverlayController extends EventTarget { if (phase === 'init' || phase === 'teardown') { this.__setupTeardownAccessibility({ phase }); } - const isModal = this.hasBackdrop; + const isModal = this.trapsKeyboardFocus; if (this.invokerNode && !this.isTooltip && !isModal) { this.invokerNode.setAttribute('aria-expanded', `${phase === 'show'}`); } diff --git a/packages/ui/components/overlays/test/OverlayController.test.js b/packages/ui/components/overlays/test/OverlayController.test.js index 2de9620c9..898adbe40 100644 --- a/packages/ui/components/overlays/test/OverlayController.test.js +++ b/packages/ui/components/overlays/test/OverlayController.test.js @@ -1534,7 +1534,7 @@ describe('OverlayController', () => { ); const ctrl = new OverlayController({ ...withLocalTestConfig(), - hasBackdrop: true, + trapsKeyboardFocus: true, handlesAccessibility: true, invokerNode, });