Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AUT-956] Add iframe resize logic #25

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add deprecation warning to height option
  • Loading branch information
hwhmeikle committed Apr 26, 2023
commit 9775226ba5bdddef657337c1832563272f82feb6
9 changes: 5 additions & 4 deletions src/popup-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const OVERLAY_ID = "__authsignal-popup-overlay";
const STYLE_ID = "__authsignal-popup-style";
const IFRAME_ID = "__authsignal-popup-iframe";

const DEFAULT_WIDTH = "380px";
const DEFAULT_WIDTH = "385px";

type PopupShowInput = {
url: string;
Expand All @@ -24,6 +24,7 @@ type PopupHandlerOptions = {

class PopupHandler {
private popup: A11yDialog | null = null;
private isHeightAutoResized = true;

constructor({width}: PopupHandlerOptions) {
if (document.querySelector(`#${CONTAINER_ID}`)) {
Expand Down Expand Up @@ -109,10 +110,10 @@ class PopupHandler {
}

#${CONTENT_ID} iframe {
width: 100%;
height: 100%;
width: 1px;
min-width: 100%;
border-radius: inherit;
max-height: 80vh;
max-height: 65vh;
}

@media (prefers-reduced-motion: reduce) {
Expand Down
6 changes: 5 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ type PopupLaunchOptions = BaseLaunchOptions & {
mode: "popup";
popupOptions?: {
/** Any valid CSS value for the `width` property. */
width: string;
width?: string;
/**
* @deprecated The popup will automatically resize to fit the content.
*/
height?: string;
};
};

Expand Down