Skip to content

[Resizable RHP] Basic drag logic - #104573

Open
war-in wants to merge 12 commits into
Expensify:mainfrom
software-mansion-labs:war-in/resizable-rhp-drag
Open

war-in wants to merge 12 commits into
Expensify:mainfrom
software-mansion-labs:war-in/resizable-rhp-drag

Conversation

@war-in

@war-in war-in commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Behind the resizableRHP beta, users can drag the single RHP's left edge on wide web layouts to resize it (380px to the wide RHP width minus 40px). Mid-drag the width is written to a scoped --rhp-width CSS variable, so nothing re-renders. On release it's saved to Onyx (singleRHPWidth). The drag lifecycle and size math are now shared with resizable table columns.

Fixed Issues

$ #103561
PROPOSAL:

Tests

  1. Enable the resizableRHP beta. On a wide web window, go to Account > Profile and open Timezone in the RHP.
  2. Hover the RHP's left edge.
  3. Verify that the cursor changes to col-resize and a green line shows just outside the card's left border.
  4. Drag the edge left, then right, past both limits.
  5. Verify that the card and the page inside it follow the pointer, stopping at 380px and at the wide RHP width minus 40px.
  6. Drag the edge left and release the pointer over the LHN.
  7. Verify that the RHP stays open at the new width.
  8. Close and reopen the RHP, then reload the page.
  9. Verify that the RHP opens at the dragged width both times.
  10. Shrink the browser window, then widen it again.
  11. Verify that the RHP narrows to fit the smaller window and returns to the dragged width when the window grows back.

  1. With the resizableRHP beta enabled, open an expense report in the RHP (a wide or super-wide RHP).
  2. Verify that no resize handle shows and the RHP keeps its usual width.
  3. From that expense, open a field page (a single RHP stacked on the wide one).
  4. Verify that it opens at the default width with no resize handle.
  5. Disable the beta and open any single RHP.
  6. Verify that there is no resize handle and the RHP has its default width.

  1. Enable the resizableTableColumns beta and open a table with resizable columns (for example, Workspace > Members).
  2. Drag a column's right edge.
  3. Verify that the grip and the indicator line show as before, the column resizes, and the new width is kept after a reload.

Offline tests

  1. Go offline.
  2. With the resizableRHP beta enabled, open a single RHP and drag its left edge to a new width.
  3. Close and reopen the RHP.
  4. Verify that the RHP resizes and keeps its width while offline. The width is stored locally, so no request is queued.

QA Steps

Same as tests

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 95.90% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/components/Modal/BaseModal.tsx 97.01% <100.00%> (+0.06%) ⬆️
src/components/ResizeHandle/getDraggedSize.ts 100.00% <100.00%> (ø)
...ts/Table/columnResize/ColumnResizeHandle/index.tsx 0.00% <ø> (ø)
...onents/Table/columnResize/useColumnResize/index.ts 100.00% <100.00%> (+6.38%) ⬆️
src/hooks/useIsResizableSingleRHP.ts 100.00% <100.00%> (ø)
src/hooks/useSingleRHPWidth.ts 100.00% <100.00%> (ø)
src/libs/ExportOnyxState/masking.ts 80.95% <ø> (ø)
.../AppNavigator/Navigators/getRHPFrameStyle/index.ts 100.00% <100.00%> (ø)
... and 15 more
... and 14 files with indirect coverage changes

@war-in

war-in commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review
@claude review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T09:08:29.967471Z d6788ab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

I found two issues to fix before merge. The drag logic, the usePointerDrag extraction, and the live CSS-variable approach look correct.

1. A failing CI test comes from this PR. test (job 7) fails in MoneyRequestReportTransactionsNavigationTest with useWideRHPState is not a function. BaseModal now calls useIsResizableSingleRHP() (BaseModal.tsx:259), which calls useWideRHPState(). The test's mock of @components/WideRHPContextProvider only defines useWideRHPActions (MoneyRequestReportTransactionsNavigationTest.tsx:90-92). To fix it, add useWideRHPState: () => ({wideRHPRouteKeys: [], superWideRHPRouteKeys: []}) to that mock.

2. The resizable width also applies when the beta is off. useSingleRHPWidth doesn't check the beta (useSingleRHPWidth.ts:30). Three callers use its width with no beta check:

This causes two visible effects for users without the beta:

  • Every user, at 801–813px windows: max is windowWidth - 374, which falls below the 440px default. For example, a 805px window gets a 431px RHP instead of 440px.
  • Users whose beta is removed from the account: the saved singleRHPWidth stays in Onyx. The RHP keeps that width with no handle to change it. clearSingleRHPWidth only runs from the beta override page (DynamicBetaOverridesPage.tsx:58).

To fix both, have useSingleRHPWidth return variables.rhpWidth when RESIZABLE_RHP is off. The override-page clear then becomes optional.

The other non-passing checks are Check independent approval, which doesn't depend on the code, and typecheck, which is still pending.


view run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66d9d7f61b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/pages/settings/Troubleshoot/DynamicBetaOverridesPage.tsx Outdated
@war-in
war-in marked this pull request as ready for review October 22, 2026 08:48
@war-in
war-in requested review from a team as code owners October 22, 2026 08:48
@melvin-bot
melvin-bot Bot requested review from Krishna2323 and removed request for a team October 22, 2026 08:48
@melvin-bot

melvin-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from flaviadefaria and removed request for a team October 22, 2026 08:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6788ab063

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

drag.liveWidth = liveWidth;
},
onEnd: ({liveWidth}) => {
setIsDragging(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset hover when the captured RHP drag ends

On web, if the pointer is released or cancelled outside the 12px handle, pointer capture can suppress pointerleave (the table caller explicitly hit-tests in syncGripHover because release/lost capture does not reliably fire boundary events). This callback clears only isDragging, leaving isHovered true from the initial enter, so (isHovered || isDragging) keeps the green line rendered until the user crosses the handle again; synchronize hover from the end event here as useColumnResize does.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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