Skip to content

fix: fix submit email button on what's new page#1042

Merged
Ash110 merged 1 commit intomainfrom
tasker/PRO-2451-fix-whats-new-email-submit
May 7, 2026
Merged

fix: fix submit email button on what's new page#1042
Ash110 merged 1 commit intomainfrom
tasker/PRO-2451-fix-whats-new-email-submit

Conversation

@betzlermeow
Copy link
Copy Markdown
Contributor

Description

  • Fix the broken "Submit" email button on the What's New page (/whats-new)
  • Root cause: Fern's MDX renderer strips JSX event handlers (onSubmit, onClick), so the form's validation and submission logic was never attached to the DOM. The form fell through to a native HTML POST that silently redirected back to the same page with no user feedback.
  • Fix: Move all form logic to custom.js using plain DOM addEventListener('submit', ...), which Fern does not strip
  • Replace inline styles in overview.mdx with CSS classes in styles.css for proper styling (including dark mode)
  • Add a feedback message div that shows success/error states inline after submission
  • Handle Customer.io's 302 redirect response using fetch() with redirect: 'manual' and opaqueredirect type check
  • Add MutationObserver to re-attach handler on SPA route changes (Fern uses client-side routing)
  • Guard against duplicate handler attachment with data-enhanced attribute

Closes PRO-2451

Testing Steps

  • Run the app locally using fern docs dev or navigate to preview deployment
  • Ensure that the changed pages and code snippets work
  • Navigate to the What's New page (/whats-new)
  • Enter a valid email and click Submit -- should see "Thanks for subscribing!" success message
  • Enter an invalid email and click Submit -- should see "Please enter a valid email address." error message
  • Verify button shows "Submitting..." loading state during submission
  • Verify dark mode styling works correctly for the form
  • Run tests with node fern/custom.spec.js (39 tests, 0 dependencies)

Fern's MDX renderer strips JSX event handlers (onSubmit, onClick), so the
subscribe form's validation and submission logic was never attached to the DOM.
The form fell through to a native HTML POST that silently redirected back to the
same page with no user feedback.

Move all form logic to custom.js using plain DOM event listeners, replace inline
styles with CSS classes, and add a feedback message div for success/error states.

Closes PRO-2451

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

@Ash110 Ash110 merged commit 6cce858 into main May 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants