Skip to content

Conversation

@premiumjibles
Copy link
Collaborator

@premiumjibles premiumjibles commented Jul 31, 2025

Description

Refactored the dialog component to prevent background interaction. This stuff is super fragile so please test thoroughly.

Removing isDisablingPropagation seemed to have only positive side effects except it broke the manage accounts slide in drawer. For some reason when the drawer was rendered over the top of a modal that has modal={true} , it basically couldn't register any clicks and they went straight through to the modal beneath. From what I can tell the modal was setting pointer-events: none on the drawer. Hence my hack for pointer-events: auto.

Issue (if applicable)

closes #10103

Risk

Medium, this could make dialogs behave funny which important. Note the scope of the change is mobile only.

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

  • Test every modal you can think of on mobile and make sure it all behaves as expected
  • Closing modals by clicking on overlay, close button, nested modals like manage account -> click account, etc...
  • You shouldn't be able to interact with the background while modals are opened

Engineering

☝️

Operations

☝️

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

screen-20250731-155239.2.mp4

Summary by CodeRabbit

  • Bug Fixes

    • Improved modal and drawer interaction to ensure pointer events work correctly when the manage accounts modal is open.
  • Refactor

    • Simplified the Dialog component by removing the unused event propagation prop and related logic.
    • Streamlined usage of the Dialog component across multiple dialogs for consistency.

@premiumjibles premiumjibles requested a review from a team as a code owner July 31, 2025 05:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

📝 Walkthrough

Walkthrough

The changes remove the isDisablingPropagation prop and its associated logic from the Dialog component and all its usages. The code now consistently allows pointer events on overlays and content, and simplifies the modal and drawer overlay logic. No public API signatures are altered except for the removed prop.

Changes

Cohort / File(s) Change Summary
Dialog Prop & Logic Removal
src/components/Modal/components/Dialog.tsx
Removed isDisablingPropagation prop from types and component logic; simplified overlay rendering and modal logic.
Dialog Usage Simplification
src/components/MobileWalletDialog/MobileWalletDialog.tsx,
src/components/Modals/ManageAccounts/ManageAccountsModal.tsx,
src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensCategoryDialog.tsx,
src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensFiltersDialog.tsx
Removed isDisablingPropagation={false} prop from all usages of the Dialog component.
Drawer Pointer Events Fix
src/components/ManageAccountsDrawer/components/DrawerWrapper.tsx
Added explicit pointer event styles to overlays and content to allow pointer interactions when drawer is open.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI_Component
    participant Dialog
    participant Overlay

    User->>UI_Component: Opens modal/dialog
    UI_Component->>Dialog: Render with isOpen, onClose, etc.
    Dialog->>Overlay: Render overlay (pointerEvents: auto)
    Overlay->>User: Allows pointer events
    User->>Dialog: Interact with modal content
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent body scroll and background interaction when Action sheet/modal is open (#10103)

Poem

The overlays now let pointers through,
While dialogs shed a prop or two.
No more scroll behind the sheet,
Simpler code—now that’s neat!
With every click, the modals gleam,
🐇 Code’s as smooth as a rabbit’s dream!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3afde69 and 1d9d154.

📒 Files selected for processing (6)
  • src/components/ManageAccountsDrawer/components/DrawerWrapper.tsx (1 hunks)
  • src/components/MobileWalletDialog/MobileWalletDialog.tsx (1 hunks)
  • src/components/Modal/components/Dialog.tsx (2 hunks)
  • src/components/Modals/ManageAccounts/ManageAccountsModal.tsx (1 hunks)
  • src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensCategoryDialog.tsx (1 hunks)
  • src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensFiltersDialog.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensCategoryDialog.tsx (3)

Learnt from: NeOMakinG
PR: #10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers//{.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Learnt from: NeOMakinG
PR: #10148
File: src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx:88-91
Timestamp: 2025-07-30T20:57:48.176Z
Learning: In src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx, NeOMakinG prefers keeping the hardcoded overscan value (40) over dynamic calculation based on viewport height, prioritizing code simplicity over precision when the current approach works effectively.

src/components/ManageAccountsDrawer/components/DrawerWrapper.tsx (4)

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers//{.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Learnt from: NeOMakinG
PR: #10148
File: src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx:88-91
Timestamp: 2025-07-30T20:57:48.176Z
Learning: In src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx, NeOMakinG prefers keeping the hardcoded overscan value (40) over dynamic calculation based on viewport height, prioritizing code simplicity over precision when the current approach works effectively.

Learnt from: NeOMakinG
PR: #10133
File: src/components/MultiHopTrade/components/SharedTradeInput/SharedTradeInputHeader.tsx:37-38
Timestamp: 2025-07-29T08:58:28.958Z
Learning: In the ShapeShift web app, CSS custom properties like --safe-area-inset-top and --safe-area-inset-bottom are centrally initialized to '0px' in src/theme/theme.tsx within the global body styles. The mobile app overrides these values when running in mobile app scope. This architectural approach eliminates the need for fallback values in var() expressions throughout the codebase, since the variables are guaranteed to be defined.

Learnt from: NeOMakinG
PR: #10133
File: src/components/MultiHopTrade/components/SharedTradeInput/SharedTradeInput.tsx:37-40
Timestamp: 2025-07-29T08:57:09.276Z
Learning: In the ShapeShift web app, CSS custom properties like --safe-area-inset-top and --safe-area-inset-bottom are centrally initialized to '0px' in src/theme/theme.tsx within the global body styles. The mobile app overrides these values when running in mobile app scope. This architectural approach eliminates the need for fallback values in var() expressions throughout the codebase, since the variables are guaranteed to be defined.

src/components/MobileWalletDialog/MobileWalletDialog.tsx (2)

Learnt from: NeOMakinG
PR: #10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Learnt from: NeOMakinG
PR: #10148
File: src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx:88-91
Timestamp: 2025-07-30T20:57:48.176Z
Learning: In src/components/MarketTableVirtualized/MarketsTableVirtualized.tsx, NeOMakinG prefers keeping the hardcoded overscan value (40) over dynamic calculation based on viewport height, prioritizing code simplicity over precision when the current approach works effectively.

src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensFiltersDialog.tsx (2)

Learnt from: NeOMakinG
PR: #10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers//{.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

src/components/Modals/ManageAccounts/ManageAccountsModal.tsx (2)

Learnt from: NeOMakinG
PR: #10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers//{.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

src/components/Modal/components/Dialog.tsx (2)

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers//{.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Learnt from: NeOMakinG
PR: #10128
File: .cursor/rules/react-best-practices.mdc:8-14
Timestamp: 2025-07-29T10:27:23.424Z
Learning: The ShapeShift team practices aggressive memoization in React components as documented in .cursor/rules/react-best-practices.mdc. They use useMemo for all transformations, derived values, and conditional values, and useCallback for all event handlers and functions that could be passed as props. This approach was adopted after experiencing performance issues ("had hard time") and is their current established practice, though they acknowledge it may evolve in the future.

🧬 Code Graph Analysis (4)
src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensCategoryDialog.tsx (1)
src/components/Modal/components/Dialog.tsx (1)
  • Dialog (113-113)
src/components/MobileWalletDialog/MobileWalletDialog.tsx (1)
src/components/Modal/components/Dialog.tsx (1)
  • Dialog (113-113)
src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensFiltersDialog.tsx (1)
src/components/Modal/components/Dialog.tsx (1)
  • Dialog (113-113)
src/components/Modals/ManageAccounts/ManageAccountsModal.tsx (1)
src/components/Modal/components/Dialog.tsx (1)
  • Dialog (113-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (6)
src/components/Modals/ManageAccounts/ManageAccountsModal.tsx (1)

124-124: LGTM! Clean refactor aligning with modal behavior improvements.

The removal of isDisablingPropagation={false} is consistent with the broader refactor to fix modal body scrolling issues. The Dialog component now handles event propagation internally, which should improve mobile modal behavior.

src/components/MobileWalletDialog/MobileWalletDialog.tsx (1)

72-72: LGTM! Consistent with the modal refactor.

The removal of isDisablingPropagation={false} maintains consistency with the broader modal behavior improvements across the codebase.

src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensFiltersDialog.tsx (1)

100-100: LGTM! Important fix for scrollable dialog content.

Removing isDisablingPropagation={false} is particularly beneficial here since this dialog contains scrollable content. This should prevent background scroll conflicts on mobile devices.

src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokensCategoryDialog.tsx (1)

58-58: LGTM! Completes the consistent modal refactor.

The removal of isDisablingPropagation={false} maintains consistency with the other dialog components in this PR, completing the systematic modal behavior improvements.

src/components/ManageAccountsDrawer/components/DrawerWrapper.tsx (2)

10-11: LGTM! Essential workaround for drawer-over-modal scenarios.

This const and comment clearly document the specific issue described in the PR: when the manage accounts drawer is rendered over a modal, the modal's pointer-events: none would block drawer interactions.


16-17: LGTM! Correctly applies pointer event override to both overlay and content.

Applying overrideStyles to both DrawerOverlay and DrawerContent ensures the drawer remains fully interactive when rendered over a modal, solving the specific issue mentioned in the PR description.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 10103_body_scrolling_2

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@premiumjibles premiumjibles marked this pull request as draft July 31, 2025 05:58
@premiumjibles premiumjibles marked this pull request as ready for review July 31, 2025 06:04
@premiumjibles premiumjibles force-pushed the 10103_body_scrolling_2 branch from 3afde69 to 1d9d154 Compare July 31, 2025 06:14
Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

Seems like it does the do:

https://jam.dev/c/ee5a7e2b-a36c-4ea4-906a-814c94f2f277

Nice fix 👍

@NeOMakinG NeOMakinG enabled auto-merge (squash) July 31, 2025 14:38
@NeOMakinG NeOMakinG merged commit dc26883 into develop Jul 31, 2025
4 checks passed
@NeOMakinG NeOMakinG deleted the 10103_body_scrolling_2 branch July 31, 2025 14:40
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.

Prevent body scroll when Action sheet is open

3 participants