Skip to content

fix(AuthDialog): render stories in iframe to prevent overflow:hidden …#45

Merged
garrity-miepub merged 2 commits intomainfrom
feature/authdialog-updtes
Jan 31, 2026
Merged

fix(AuthDialog): render stories in iframe to prevent overflow:hidden …#45
garrity-miepub merged 2 commits intomainfrom
feature/authdialog-updtes

Conversation

@garrity-miepub
Copy link
Copy Markdown
Contributor

…leak

The AuthDialog component sets document.body.style.overflow = 'hidden' when open, which was preventing the Storybook docs page from scrolling.

Added docs.story.inline: false and iframeHeight: 600 to meta.parameters to isolate the component in an iframe, preventing the styles from affecting the parent docs page.

authdialog.mov

…leak

The AuthDialog component sets document.body.style.overflow = 'hidden' when
open, which was preventing the Storybook docs page from scrolling.

Added docs.story.inline: false and iframeHeight: 600 to meta.parameters
to isolate the component in an iframe, preventing the styles from
affecting the parent docs page.
…ractive controls

- Fix scroll lock issue caused by AuthDialog setting body overflow:hidden
  - Add MutationObserver in AuthDialogDemo to continuously clear overflow:hidden
  - This prevents the modal's scroll lock from affecting Storybook docs page

- Add comprehensive Storybook controls for interactive demos
  - initialMode: Switch between login, signup, forgotPassword, etc.
  - showSocialProviders: Toggle social auth buttons visibility
  - appName: Customize the dialog header text
  - logoUrl: Add custom branding logo
  - termsUrl/privacyUrl: Configure legal links
  - requireEmailVerification: Toggle email verification requirement

- Organize controls into categories: Demo Controls, Branding, URLs, Settings

- Hide component props that conflict with demo wrapper (isOpen, mode, onClose, etc.)
  - These are managed internally by AuthDialogDemo for proper demonstration

- Fix broken placeholder image URL (via.placeholder.com -> placehold.co)

Controls now work on both Canvas and Docs pages while maintaining scroll functionality.
Copilot AI review requested due to automatic review settings January 31, 2026 02:13
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: d438566
Status: ✅  Deploy successful!
Preview URL: https://b28c88a3.ui-6d0.pages.dev
Branch Preview URL: https://feature-authdialog-updtes.ui-6d0.pages.dev

View logs

@garrity-miepub garrity-miepub marked this pull request as ready for review January 31, 2026 02:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix an issue where the AuthDialog component's overflow:hidden style on the document body was preventing the Storybook docs page from scrolling. However, the implementation differs significantly from what's described in the PR description.

Changes:

  • Added comprehensive Storybook controls with a new DemoControls interface and type system for better story interactivity
  • Implemented a MutationObserver-based workaround to continuously reset body overflow styles
  • Refactored story definitions to use Storybook args pattern with proper render functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@garrity-miepub
Copy link
Copy Markdown
Contributor Author

Thanks for the review! We actually tried the inline: false iframe isolation approach first (it was in the initial commit), but discovered it breaks the Storybook controls on the Docs page.

When stories are rendered in iframes with inline: false, the controls panel in the docs page cannot communicate with the iframe content - changing a control value doesn't update the story preview. This makes the interactive controls non-functional, which defeats the purpose of adding them.

The MutationObserver approach was chosen as a deliberate trade-off because:

  1. Controls work on both Canvas and Docs pages - users can interactively switch between login/signup modes, toggle social providers, etc.
  2. Scoped impact - it only monitors and resets overflow: hidden, not other style changes
  3. Proper cleanup - the observer disconnects when the component unmounts
  4. Only affects demo wrapper - the MutationObserver is in AuthDialogDemo (the Storybook wrapper), not the actual AuthDialog component

The dialog being "always open" in stories is intentional for documentation purposes - we want users to see the component immediately without having to click a button first. The observer runs while the story is mounted, which is the expected behavior.

If there's a way to use iframe isolation while maintaining controls functionality, I'd be happy to explore it!

@garrity-miepub garrity-miepub merged commit e8ba5d5 into main Jan 31, 2026
16 checks passed
@garrity-miepub garrity-miepub deleted the feature/authdialog-updtes branch January 31, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants