fix: clean code for overlay isModal
This commit is contained in:
parent
6f35b81293
commit
89360b56db
2 changed files with 3 additions and 3 deletions
|
|
@ -640,7 +640,7 @@ export class OverlayController extends EventTarget {
|
||||||
__setupTeardownAccessibility({ phase }) {
|
__setupTeardownAccessibility({ phase }) {
|
||||||
if (phase === 'init') {
|
if (phase === 'init') {
|
||||||
this.__storeOriginalAttrs(this.contentNode, ['role', 'id']);
|
this.__storeOriginalAttrs(this.contentNode, ['role', 'id']);
|
||||||
const isModal = this.hasBackdrop;
|
const isModal = this.trapsKeyboardFocus;
|
||||||
|
|
||||||
if (this.invokerNode) {
|
if (this.invokerNode) {
|
||||||
const attributesToStore = ['aria-labelledby', 'aria-describedby'];
|
const attributesToStore = ['aria-labelledby', 'aria-describedby'];
|
||||||
|
|
@ -1300,7 +1300,7 @@ export class OverlayController extends EventTarget {
|
||||||
if (phase === 'init' || phase === 'teardown') {
|
if (phase === 'init' || phase === 'teardown') {
|
||||||
this.__setupTeardownAccessibility({ phase });
|
this.__setupTeardownAccessibility({ phase });
|
||||||
}
|
}
|
||||||
const isModal = this.hasBackdrop;
|
const isModal = this.trapsKeyboardFocus;
|
||||||
if (this.invokerNode && !this.isTooltip && !isModal) {
|
if (this.invokerNode && !this.isTooltip && !isModal) {
|
||||||
this.invokerNode.setAttribute('aria-expanded', `${phase === 'show'}`);
|
this.invokerNode.setAttribute('aria-expanded', `${phase === 'show'}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1534,7 +1534,7 @@ describe('OverlayController', () => {
|
||||||
);
|
);
|
||||||
const ctrl = new OverlayController({
|
const ctrl = new OverlayController({
|
||||||
...withLocalTestConfig(),
|
...withLocalTestConfig(),
|
||||||
hasBackdrop: true,
|
trapsKeyboardFocus: true,
|
||||||
handlesAccessibility: true,
|
handlesAccessibility: true,
|
||||||
invokerNode,
|
invokerNode,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue