Skip to content

Commit

Permalink
chore: adds scale prop
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuascan committed Jan 31, 2025
1 parent 49e3352 commit 429be65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions packages/magic-sdk/src/iframe-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import { MagicIncomingWindowMessage, MagicOutgoingWindowMessage } from '@magic-s
const overlayStyles: Partial<CSSStyleDeclaration> = {
display: 'block',
visibility: 'hidden',
pointerEvents: 'none',
position: 'fixed',
top: '0',
right: '0',
width: '100%',
height: '100%',
borderRadius: '0',
border: 'none',
zIndex: '-1',
// necessary for iOS Safari
opacity: '0',
// necessary for iOS 17 and earlier
zIndex: '-1',
transform: 'scale(0)',
};

/**
Expand Down Expand Up @@ -129,8 +130,8 @@ export class IframeController extends ViewController {
protected async showOverlay() {
const iframe = await this.iframe;
iframe.style.visibility = 'visible';
iframe.style.pointerEvents = 'auto';
iframe.style.zIndex = '2147483647';
iframe.style.transform = 'scale(1)';
iframe.style.opacity = '1';
this.activeElement = document.activeElement;
iframe.focus();
Expand All @@ -139,8 +140,8 @@ export class IframeController extends ViewController {
protected async hideOverlay() {
const iframe = await this.iframe;
iframe.style.visibility = 'hidden';
iframe.style.pointerEvents = 'none';
iframe.style.zIndex = '-1';
iframe.style.transform = 'scale(0)';
iframe.style.opacity = '0';
if (this.activeElement?.focus) this.activeElement.focus();
this.activeElement = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('Change visibility style to `hidden` and opacity to 0', async () => {
await (overlay as any).hideOverlay();

expect((overlay as any).iframe).toEqual({
style: { visibility: 'hidden', opacity: '0', pointerEvents: 'none', zIndex: '-1' },
style: { visibility: 'hidden', opacity: '0', zIndex: '-1', transform: 'scale(0)' },
});
});

Expand Down

0 comments on commit 429be65

Please sign in to comment.