Skip to content

fix(web): alert modals not clickable when shown above expo-router modals#5

Merged
leeroybrun merged 1 commit intomainfrom
slopus/pr/fix-modal-button-click
Jan 11, 2026
Merged

fix(web): alert modals not clickable when shown above expo-router modals#5
leeroybrun merged 1 commit intomainfrom
slopus/pr/fix-modal-button-click

Conversation

@leeroybrun
Copy link
Collaborator

@leeroybrun leeroybrun commented Jan 11, 2026

On web, when an alert modal is shown while an expo-router modal (like "new session") is open, the alert's OK button was unclickable. This happened because expo-router sets pointer-events: none on body and pointer-events: auto on its own overlay, which intercepted clicks meant for our alert modal.

Fix:

  • Add pointerEvents: 'auto' to modal container to enable interactions
  • Stop event propagation on web to prevent clicks from reaching expo-router's overlay

Summary by CodeRabbit

  • Bug Fixes
    • Fixed modal click/tap interactions on web to prevent unintended event propagation, improving reliability when interacting with the backdrop and controls.
    • Restored pointer-event behavior on web so modals consistently receive user input without affecting existing backdrop and animation behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link

Summary of Changes

Hello @leeroybrun, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical UI interaction bug on the web platform where alert modals became unresponsive when displayed concurrently with expo-router modals. The fix ensures that alert modals correctly receive pointer events and user interactions by explicitly managing event propagation and pointer event styling, thereby restoring expected functionality and improving user experience.

Highlights

  • Web Modal Interaction Fix: Addressed an issue where alert modals on web were unclickable when displayed over expo-router modals due to pointer-events interference, ensuring proper user interaction.
  • Event Propagation Control: Implemented a mechanism to stop event propagation for web-specific click and pointer-down events, preventing them from being intercepted by underlying expo-router overlays.
  • Pointer Events Styling: Applied pointerEvents: 'auto' to the modal container's style specifically for web platforms, ensuring the modal can correctly receive interactions even when the body has pointer-events: none.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 11, 2026

📝 Walkthrough

Walkthrough

Adds web-specific event handlers and pointer-events styling to BaseModal to stop click/pointer propagation on web and enable pointer interactions when the page body has pointer-events: none; handlers are applied to KeyboardAvoidingView. No public APIs or exports were changed.

Changes

Cohort / File(s) Summary
Web Event Handling Enhancement
sources/modal/components/BaseModal.tsx
Added stopPropagation helper and webEventHandlers (onClick/onPointerDown) gated by Platform.OS === 'web'; spread handlers onto KeyboardAvoidingView; set container pointerEvents: 'auto' via Platform.select; retained existing modal/backdrop/animation structure and comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit taps the web modal door,
“Halt!” says each click, they reach no more.
Pointer paths kindly come to rest,
The dialog holds its gentle nest.
Hooray—no echoes of the quest! 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main fix: addressing the issue where alert modals are not clickable when shown above expo-router modals on web.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef1856c and 6c428d7.

📒 Files selected for processing (1)
  • sources/modal/components/BaseModal.tsx
🔇 Additional comments (3)
sources/modal/components/BaseModal.tsx (3)

12-17: LGTM! Solid approach to prevent event propagation on web.

The combination of onClick, onPointerDown, and onTouchStart comprehensively covers mouse, pointer, and touch inputs. Module-level Platform.OS check is appropriate since it's a static value.


67-71: LGTM! Correct placement for event handlers.

Attaching event handlers at the KeyboardAvoidingView level ensures all clicks within the modal are captured before they can propagate to expo-router's overlay.


111-114: LGTM! Correct fix for the pointer-events inheritance issue.

Setting pointerEvents: 'auto' on the container re-enables pointer interactions for the modal and its children when expo-router applies pointer-events: none to the body. The as const assertion ensures proper TypeScript narrowing.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue on the web where alert modals were not clickable when appearing over an expo-router modal. The fix is implemented by stopping event propagation from the modal container and explicitly setting pointerEvents: 'auto' to ensure the modal can receive interactions. The approach is sound and effectively resolves the described problem. I have one suggestion to improve the TypeScript typings for better code clarity and long-term maintainability.


// On web, stop events from propagating to expo-router's modal overlay
// which intercepts clicks when it applies pointer-events: none to body
const stopPropagation = (e: { stopPropagation: () => void }) => e.stopPropagation();

Choose a reason for hiding this comment

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

medium

For better type safety and code clarity, it's recommended to use a more specific type for the event object. Since React is already imported in this file, you can use React.SyntheticEvent as the base type for the event. This is more idiomatic in a React environment than a structural type like { stopPropagation: () => void }.

Suggested change
const stopPropagation = (e: { stopPropagation: () => void }) => e.stopPropagation();
const stopPropagation = (e: React.SyntheticEvent) => e.stopPropagation();

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
sources/modal/components/BaseModal.tsx (1)

12-17: Consider adding onTouchStart for mobile web compatibility.

The current handlers cover mouse interactions (onClick, onPointerDown), but mobile web browsers may also dispatch touch events. Adding onTouchStart: stopPropagation would ensure the fix works consistently on touch-enabled web browsers.

Suggested improvement
 const stopPropagation = (e: { stopPropagation: () => void }) => e.stopPropagation();
 const webEventHandlers = Platform.OS === 'web'
-    ? { onClick: stopPropagation, onPointerDown: stopPropagation }
+    ? { onClick: stopPropagation, onPointerDown: stopPropagation, onTouchStart: stopPropagation }
     : {};
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0b620c and ef1856c.

📒 Files selected for processing (1)
  • sources/modal/components/BaseModal.tsx
🔇 Additional comments (2)
sources/modal/components/BaseModal.tsx (2)

67-71: LGTM!

Spreading webEventHandlers at the KeyboardAvoidingView level is appropriate—it wraps the entire modal content and ensures events are stopped at the outermost container.


111-114: LGTM!

The Platform.select approach with as const is idiomatic for applying web-specific styles, and the inline comment clearly explains the rationale. This correctly ensures the modal container can receive pointer events when expo-router sets pointer-events: none on the body.

On web, when an alert modal is shown while an expo-router modal (like "new session") is open, the alert's OK button was unclickable. This happened because expo-router sets pointer-events: none on body and pointer-events: auto on its own overlay, which intercepted clicks meant for our alert modal.

Fix:
- Add pointerEvents: 'auto' to modal container to enable interactions
- Stop event propagation on web to prevent clicks from reaching expo-router's overlay
@leeroybrun leeroybrun force-pushed the slopus/pr/fix-modal-button-click branch from ef1856c to 6c428d7 Compare January 11, 2026 21:59
@leeroybrun leeroybrun merged commit f7c0d57 into main Jan 11, 2026
2 checks passed
leeroybrun pushed a commit that referenced this pull request Jan 22, 2026
fix: correctly escape Windows paths for project ids
@leeroybrun leeroybrun deleted the slopus/pr/fix-modal-button-click branch January 31, 2026 15:33
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.

1 participant