Skip to content

Commit

Permalink
Merge pull request #2356 from ing-bank/fix/overlay-is-modal
Browse files Browse the repository at this point in the history
fix: clean code for overlay isModal
  • Loading branch information
okadurin authored Aug 28, 2024
2 parents 6f35b81 + 89360b5 commit c6a8d6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/ui/components/overlays/src/OverlayController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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'}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ describe('OverlayController', () => {
);
const ctrl = new OverlayController({
...withLocalTestConfig(),
hasBackdrop: true,
trapsKeyboardFocus: true,
handlesAccessibility: true,
invokerNode,
});
Expand Down

0 comments on commit c6a8d6d

Please sign in to comment.