Skip to content

Commit

Permalink
fix: leverage "dvh" rather than measured screen height
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Dec 2, 2022
1 parent 628ec2c commit 84b9df0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
12 changes: 1 addition & 11 deletions packages/overlay/src/ActiveOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,8 @@ export class ActiveOverlay extends SpectrumElement {

this.state = 'active';

// force paint
// this prevents a timing issue that can show up in tests as
// 'Error: Timeout: Wait for decorator to become ready...'
this.offsetWidth;

this.feature();
if (this.placement === 'none') {
this.style.setProperty(
'--swc-visual-viewport-height',
`${window.innerHeight}px`
);
} else if (this.placement) {
if (this.placement && this.placement !== 'none') {
await this.updateOverlayPosition();
document.addEventListener(
'sp-update-overlays',
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/src/active-overlay.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ governing permissions and limitations under the License.
:host([placement='none']) {
position: fixed;
height: 100vh;
height: 100dvh;
height: fill-available;
max-height: var(--swc-visual-viewport-height);
top: 0;
left: 0;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/tray/src/tray.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ governing permissions and limitations under the License.
:host {
align-items: flex-end;
position: fixed !important;
max-height: var(--swc-visual-viewport-height);
max-height: 100vh;
max-height: 100dvh;
}

sp-underlay {
Expand Down

0 comments on commit 84b9df0

Please # to comment.