Skip to content

Add collapsible Spend sidebar#91974

Open
KJ21-ENG wants to merge 9 commits into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/91553-spend-sidebar-collapse
Open

Add collapsible Spend sidebar#91974
KJ21-ENG wants to merge 9 commits into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/91553-spend-sidebar-collapse

Conversation

@KJ21-ENG
Copy link
Copy Markdown
Contributor

@KJ21-ENG KJ21-ENG commented May 28, 2026

Explanation of Change

Adds the desktop Spend sidebar collapse/expand behavior behind the Spend search page. The sidebar now starts expanded, can be collapsed to a 76px icon rail, temporarily peeks open on hover over the collapsed rail, keeps section accordions available when expanded, and shifts the main Spend content only for the persisted expanded/collapsed state.

Fixed Issues

$ #91553
PROPOSAL: #91553 (comment)

Tests

  1. Open the desktop web app and sign in with an account that has the Spend module available.
  2. Navigate to Spend > Expenses.
  3. Verify the Spend sidebar starts expanded and the Expenses content appears to the right of it.
  4. Click the sidebar collapse button.
  5. Verify the sidebar collapses to the 76px icon rail, labels are hidden, and section headers render as dividers.
  6. Hover over the collapsed Spend sidebar.
  7. Verify the sidebar temporarily expands over the content while hovered.
  8. Move the cursor away from the sidebar.
  9. Verify the sidebar returns to the collapsed icon rail.
  10. Click the expand button.
  11. Verify the sidebar remains expanded and the Expenses content is laid out to the right of the expanded sidebar.
  • Verify that no errors appear in the JS console

Offline tests

N/A. This is a desktop layout-only change for the Spend sidebar and does not add or change network-dependent behavior.

QA Steps

Same as Tests.

  • Verify that no errors appear in the JS console

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 followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

N/A - desktop-only Spend sidebar behavior.

Android: mWeb Chrome

N/A - desktop-only Spend sidebar behavior.

iOS: Native

N/A - desktop-only Spend sidebar behavior.

iOS: mWeb Safari

N/A - desktop-only Spend sidebar behavior.

MacOS: Chrome / Safari
Screen.Recording.2026-05-29.at.3.08.50.AM.mov

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

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

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/components/Navigation/TopBar.tsx 100.00% <100.00%> (ø)
src/styles/index.ts 59.06% <ø> (+1.55%) ⬆️
src/styles/variables.ts 100.00% <ø> (ø)
src/libs/actions/SearchSidebar.ts 0.00% <0.00%> (ø)
src/pages/Search/SearchPageWide.tsx 0.00% <0.00%> (ø)
src/pages/Search/SearchTypeMenuWide.tsx 0.00% <0.00%> (ø)
...ponents/Search/SearchList/BaseSearchList/index.tsx 0.00% <0.00%> (ø)
src/pages/Search/SavedSearchList.tsx 0.00% <0.00%> (ø)
... and 4 more
... and 240 files with indirect coverage changes

@KJ21-ENG KJ21-ENG force-pushed the KJ21-ENG/91553-spend-sidebar-collapse branch from d814ac4 to da13d13 Compare May 28, 2026 21:34
@KJ21-ENG KJ21-ENG changed the title [WIP] Add collapsible Spend sidebar Add collapsible Spend sidebar May 28, 2026
@KJ21-ENG KJ21-ENG marked this pull request as ready for review May 28, 2026 21:44
@KJ21-ENG KJ21-ENG requested review from a team as code owners May 28, 2026 21:44
@melvin-bot melvin-bot Bot requested review from eVoloshchak and heyjennahay May 28, 2026 21:44
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 28, 2026

@eVoloshchak 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]

@github-actions
Copy link
Copy Markdown
Contributor

🚧 @dubielzyk-expensify has triggered a test Expensify/App build. You can view the workflow run here.

@dubielzyk-expensify
Copy link
Copy Markdown
Contributor

This is a wonderful start and work quite well. Great job on this so far.

There's a jump in the table that happens when we collapse. Can you help get rid of this?

CleanShot.2026-05-29.at.12.12.57.mp4

@dubielzyk-expensify
Copy link
Copy Markdown
Contributor

There's also a question if we should store some sort of NVP to keep your choice of collapsing persistent across sessions. I think it'd be nice, but not sure if it's crucial. Curious if @trjExpensify or @Expensify/design has any opinions here

@trjExpensify
Copy link
Copy Markdown
Contributor

I think that would be nice, as it doesn't survive a page refresh which is a bit annoying.

@trjExpensify
Copy link
Copy Markdown
Contributor

P.S - we seem to be missing the saved search icon in the collapsed state:

image image

@trjExpensify
Copy link
Copy Markdown
Contributor

When I try to interact with the button to expand/collapse, I feel like I'm chasing it because on hover the side pane moves. I wonder if we should have that hover area over the icon remain static? Might be a terrible idea... but here's me on the chase:

2026-05-29_03-27-44.mp4

@dubielzyk-expensify
Copy link
Copy Markdown
Contributor

I get this feeling. I had it during prototype. It's the nature of the peeking functionality.

Do you mean that we shouldn't collapse it until you hover out of the sidebar? Or do you mean that there's an invisible button that allows you to click the same spot to expand it?

I think the reality is that people aren't gonna turn it off and on all the time, but I still feel you on this feedback cause it does feel a bit off.

Another solution could be that when it's in the collapsed state and you peek, then it only collapses again on a tiny bit of a delay. That way if you hover over the edge and back again it doesn't instantly go away.

@shawnborton
Copy link
Copy Markdown
Contributor

Re: the chasing feeling, I think I agree, and one idea could be to move the icon to the left of the word Spend? This way the icon never actually moves. That might not look as good though, but it would solve the problem.

@shawnborton
Copy link
Copy Markdown
Contributor

Are we able to fix the animation that happens when the table is shrinking/growing? Note that in this case it looks like the table gets too wide and goes off the screen, whereas the table header stays perfectly fixed as we'd want it to be:
CleanShot 2026-05-29 at 10 51 04@2x

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

There's also a question if we should store some sort of NVP to keep your choice of collapsing persistent across sessions. I think it'd be nice, but not sure if it's crucial. Curious if @trjExpensify or @Expensify/design has any opinions here

I think that would be nice, as it doesn't survive a page refresh which is a bit annoying.

@dubielzyk-expensify @trjExpensify implimented this in ef2bce6 . Let me know if that works

Screen.Recording.2026-05-29.at.2.43.22.PM.mp4

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

P.S - we seem to be missing the saved search icon in the collapsed state:

@trjExpensify

Yes, it was the bug and got fixed in a5772ce

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

Are we able to fix the animation that happens when the table is shrinking/growing?

There's a jump in the table that happens when we collapse.

@shawnborton Are you referring to this? If so, it looks like @dubielzyk-expensify was referring to the same thing, and I am currently working on it.

1780036973917602.mp4

@shawnborton
Copy link
Copy Markdown
Contributor

Yes exactly, sorry for the double comment - I need to get better at reading!

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

P.S - we seem to be missing the saved search icon in the collapsed state:

@trjExpensify

Yes, it was the bug and got fixed in a5772ce

@trjExpensify While validating this fix, I noticed another behavior around saved searches: when a saved search has the same underlying query/hash as a built-in tab like Expenses, navigating from that saved search back to Expenses can keep the saved search visually active.

It looks like the active sidebar state is being determined by query hash only, so a saved search and built-in tab with the same query become visually indistinguishable.

Is this expected behavior, or should this be treated as a bug? If it’s a bug, should we raise a separate issue where I can get assigned and work on it?

Screen.Recording.2026-05-29.at.2.52.11.PM.mp4

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

KJ21-ENG commented May 29, 2026

shawnborton Are you referring to this? If so, it looks like dubielzyk-expensify was referring to the same thing, and I am currently working on it.

Following up on this.
@dubielzyk-expensify @shawnborton Fixed that issue in d81b727 . Let me know it that works. Thanks.

1780054306014666.mp4

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

KJ21-ENG commented May 29, 2026

When I try to interact with the button to expand/collapse, I feel like I'm chasing it because on hover the side pane moves. I wonder if we should have that hover area over the icon remain static? Might be a terrible idea... but here's me on the chase:

Following up on this.

I have prepared a solution (prototype) inspired by this, as I also feel stable toggle-position approach addresses the chasing issue. However, the question now is: does it compromise the visual appearance?

Looking for opinions.

cc: @dubielzyk-expensify @trjExpensify @shawnborton

Screen.Recording.2026-05-29.at.6.17.42.PM.mp4

Another solution could be that when it's in the collapsed state and you peek, then it only collapses again on a tiny bit of a delay. That way if you hover over the edge and back again it doesn't instantly go away.

P.S. - I didn't quite get the point about how this will help solve the chasing issue. @dubielzyk-expensify could you please elaborate on this? Once I understand better, I can prepare a prototype so we have a few options to choose from.

Thanks.

@shawnborton
Copy link
Copy Markdown
Contributor

If we can get all of the icons and text to line up between the top header and bottom rows, it might not be so bad:
CleanShot 2026-05-29 at 15 32 41@2x

But definitely curious for Jon's opinion since this is his brain child 🧠

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

Yes, we can, and technically we should. In fact, I tried that first, but it didn't look visually appealing to me. Because "Spend" acts as a header, aligning it perfectly with the others didn't feel quite right, so I shifted it slightly to the right.

That might just be my personal observation, though, so I'm attaching a preview here for better clarity.

Screenshot 2026-05-29 at 8 37 53 PM
Screen.Recording.2026-05-29.at.8.42.20.PM.mov

@shawnborton
Copy link
Copy Markdown
Contributor

Yeah, it definitely doesn't feel as nice as we had it before. I'm definitely not sold on this as a requirement, again let's see what Jon prefers here and follow suit.

@dannymcclain
Copy link
Copy Markdown
Contributor

Yeah, it definitely doesn't feel as nice as we had it before. I'm definitely not sold on this as a requirement, again let's see what Jon prefers here and follow suit.

Totally agree 🤝

@KJ21-ENG
Copy link
Copy Markdown
Contributor Author

Yeah, it definitely doesn't feel as nice as we had it before. I'm definitely not sold on this as a requirement, again let's see what Jon prefers here and follow suit.

I am also on the same boat 👀

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.

5 participants