Skip to content

Commit

Permalink
fix(core:modal): scroll check lifecycle
Browse files Browse the repository at this point in the history
- fix edge case of scroll check happening before first render

Signed-off-by: Cory Rylan <splintercode.cb@gmail.com>
  • Loading branch information
coryrylan committed Feb 2, 2022
1 parent 7b97d4f commit 6c4c8ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/modal/modal.element.ts
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.
* Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/
Expand Down Expand Up @@ -150,8 +150,9 @@ export class CdsModal extends CdsInternalOverlay {
this.observers.forEach(o => o.disconnect());
}

private setScrollableProperties() {
private async setScrollableProperties() {
if (this.hidden === false) {
await this.updateComplete; // wait until after render to measure if scrollable
this.isScrollable = isScrollable(this.content);
this.content.tabIndex = this.isScrollable ? 0 : -1;
this.content.ariaLabel = this.isScrollable ? this.i18n.contentBox : null;
Expand Down

0 comments on commit 6c4c8ca

Please sign in to comment.