Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tighten newsletter-modal-hide to require an email input#127

Merged
twschiller merged 1 commit into
mainfrom
fix/newsletter-modal-hide-tightening
Jun 4, 2026
Merged

Tighten newsletter-modal-hide to require an email input#127
twschiller merged 1 commit into
mainfrom
fix/newsletter-modal-hide-tightening

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Summary

  • Drops the form-only branch of the newsletter-modal-hide candidate filter; now requires an <input type="email"> descendant for generic [role="dialog"] matches to fire. Vendor-specific selectors (Sumo, OptinMonster, Privy, Mailchimp, Klaviyo, etc.) still go through the same gate.
  • Adds a regression test that mirrors GitHub's "Create new issue" template chooser shape — a fixed-position role="dialog" with a <form> wrapping template links, no email input, and incidental signup-keyword copy. Test fails on main and passes after the fix.

Why this rule

Of the default-on rules that hide DOM, newsletter-modal-hide is the only one whose generic surface ([role="dialog"], [role="alertdialog"], .modal.show, .popup) could catch GitHub's chooser. cookie-banner-hide requires aria-label*="cookie|consent"; chat-widget-hide is vendor-id only; ads-hide's EasyList list has no generic dialog/overlay selectors (I grepped). Threading the issue through this rule's filter is the narrowest fix.

The form-only branch was redundant for real-world coverage: every newsletter popup that's also worth firing on collects an email, so requiring input[type="email"] doesn't lose vendors. It does close the door on a class of false positives — any application dialog (issue chooser, search, command palette, comment form) whose textContent happens to include "subscribe" / "sign up" / "stay updated" was previously eligible.

Test plan

  • bun run test — 992 passing, including the new regression case.
  • bun run check + bun run typecheck.
  • Manual (you): load this branch as an unpacked extension in Chrome with the default rules enabled, visit https://github.com/pixiebrix/agent-browser-shield/issues, click New issue, confirm the template chooser modal appears.
  • Manual (you): if the chooser still doesn't appear, the culprit is a different rule — toggle newsletter-modal-hide back on and bisect from the Options page. The new test still adds defensive coverage for the false-positive class.

Closes #126 if manual verification confirms.

🤖 Generated with Claude Code

The generic [role="dialog"] / [role="alertdialog"] selectors were gated
by an "email input OR <form>" check, which was broad enough to catch
application dialogs like GitHub's "Create new issue" template chooser
once any newsletter-keyword text appeared inside. Real newsletter
modals always include an <input type="email"> (collecting the email is
the whole point), so dropping the form-only branch keeps coverage
intact while letting form-bearing dialogs without an email field
through.

Refs #126

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 4, 2026 2:03pm

Request Review

@twschiller

Copy link
Copy Markdown
Contributor Author

Confirmed via console logs in #126 that the actual culprit is hidden-text-strip stripping Primer's dialog backdrop mid-fade-in, not this rule. Real fix is in #128. Leaving this open as an optional defensive tightening — happy to close if you'd rather not carry it.

@twschiller twschiller merged commit 8cd3984 into main Jun 4, 2026
7 checks passed
@twschiller twschiller deleted the fix/newsletter-modal-hide-tightening branch June 4, 2026 14:35
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.

Default rulesets hides New Issue template modal on GitHub

1 participant