App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Insufficient spacing between Card name and Issue card button when window is resized

Open m-natarajan opened this issue 5 months ago • 28 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.25-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @hungvu193 Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to Workspace > Expensify Card.
  2. Resize the browser window to a narrower width.
  3. Observe the spacing between the Card name label and the Issue card button.

Expected Result:

Adequate spacing is maintained between the Card name label and the Issue card button at all supported window sizes.

Actual Result:

The spacing between the Card name label and the Issue card button becomes too small when the window is resized, making the UI appear cramped.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/f7143405-85f6-418c-910b-f8a1a8022284

Image

https://github.com/user-attachments/assets/fe9109d8-2aab-4a9b-9475-5a9bbf0b59e7

View all open jobs on GitHub

Upwork Automation - Do Not Edit

m-natarajan avatar Jun 30 '26 15:06 m-natarajan

Proposal

What is the root cause of that problem?

On the Workspace > Expensify Card page, the page title (Expensify Card) and the Issue card button are rendered in the same header row whenever the layout isn't narrow-portrait. The buttons are passed as children into HeaderWithBackButton:

Inside the header, the title and the button group are siblings in one justifyContentBetween flex row (HeaderWithBackButton/index.tsx:243). The title container has flex: 1 (Header.tsx:97), so it expands to fill all available width. The only horizontal separation reserved between the title and the button group is reportOptions' fixed marginLeft: 8 (HeaderWithBackButton/index.tsx:290 → styles/index.ts:1327).

So as the window narrows (but is still wide enough to keep the buttons in the header), the flexible title consumes width right up to that fixed 8px margin, and the visible gap shrinks to ~8px → cramped.

What changes do you think we should make in order to solve the problem?

Reserve a larger guaranteed gap between the title and the button group, scoped to this page so it doesn't affect every header.

The button group already has a wrapper style array headerButtonsRowStyle at WorkspaceExpensifyCardListPage.tsx:194-199. Add a left margin (e.g. styles.ml2 / styles.ml3) to that array so the buttons keep adequate spacing from the title at all widths.

What alternative solutions did you explore? (Optional)

A global fix in Header.tsx:97 (adding flexShrink: 1 + a small marginRight to the title container) would solve it everywhere, but it touches every HeaderWithBackButton consumer and is riskier than the scoped change. Prefer the scoped fix unless design wants a global minimum gap.

Investigation details
  • Repro is the medium-width (resized but not fully narrow) desktop/web case, which matches the reported video (Chrome resized narrower). In true narrow-portrait the buttons drop to a separate line (WorkspaceExpensifyCardListPage.tsx:293) and the bug doesn't apply.
  • Confidence: High — code path and the missing minimum-gap are confirmed; the exact margin value (ml2 vs ml3) is a design call.
  • No likely duplicate open issues found.

Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94988) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.

MelvinBot avatar Jun 30 '26 15:06 MelvinBot

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 15:26:16 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Workspace > Expensify Card, the card feed name on the left and the Issue card button on the right sit in the same row. When you resize the browser to a narrower width (but not yet narrow enough to stack them), the gap between the name and the button collapses to almost nothing and the header looks cramped.

What is the root cause of that problem?

The row that holds these two elements lives at WorkspaceExpensifyCardListPage.tsx:295. Its two children are the FeedSelector (the card name) and getHeaderButtons() (Issue card / More). In the wide/landscape case the row gets flexRow + alignItemsCenter + justifyContentBetween, but it reserves no gap:

<View style={[styles.w100, styles.ph5, styles.pb3, (!shouldChangeLayout || isInLandscapeMode) && [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween]]}>

justifyContentBetween only spreads out whatever free space is left in the row. The FeedSelector's pressable wrapper is flexShrink1 (FeedSelector.tsx:48) and its name Text is flexShrink1 + numberOfLines={1} (lines 59-60). So as the window narrows, the free space runs out, the selector shrinks to fill the row, and the name ends up flush against the Issue card button. Nothing on the row enforces a minimum spacing, so it drops to ~0.

This only shows up in the side-by-side state. The horizontal row is active when (!shouldChangeLayout || isInLandscapeMode), and shouldChangeLayout = isMediumScreenWidth || shouldUseNarrowLayout. Below the medium breakpoint the conditional flips off and the buttons stack onto their own line, which is why the bug appears when resizing down toward — but not yet hitting — medium, and disappears once you cross it. Worth noting the headerButtonsRowStyle array (lines 194-199) does carry a gap2, but that is the spacing between the Issue card and More buttons, not between the FeedSelector and the button group, so it doesn't help here.

The cleanest evidence this is the right layer: the sibling Company Cards header renders the same FeedSelector-left / buttons-right row and does not have this bug, because its container already reserves a styles.gap5 (WorkspaceCompanyCardsTableHeaderButtons.tsx:129-136). The two card pages just got out of sync on this one style.

What changes do you think we should make in order to solve the problem?

Reserve a minimum horizontal gap on the row, inside the existing row-only conditional so the stacked layout is untouched:

(!shouldChangeLayout || isInLandscapeMode) && [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween, styles.gap5]

The gap is honored before justifyContentBetween distributes any leftover space, so the name and buttons always keep a minimum separation while the FeedSelector's flexShrink1 still lets the name truncate into whatever room remains. I'd match the Company Cards header's styles.gap5 (20px) here so the two card pages line up on the same value rather than picking a new one. Because the change sits inside the (!shouldChangeLayout || isInLandscapeMode) branch, the medium/narrow stacked layout and every other consumer of getHeaderButtons() are unaffected — zero blast radius.

This is a flex/CSS value, so it's not something a Jest test can meaningfully assert (RNTL can't measure rendered gap at a viewport width). I'll verify it visually on web by resizing through the large → medium range and capturing screenshots at a few widths.

What alternative solutions did you explore? (Optional)

Adding a right margin (mr*) or padding to the FeedSelector wrapper instead. It works, but it bakes the spacing into the shrinking child rather than the row, leaves stray spacing if the button side ever stops rendering, and diverges from how the Company Cards header solves the identical layout. A container gap is the symmetric fix that holds at every width.

A global change in Header.tsx / HeaderWithBackButton was also a non-starter: this row isn't a HeaderWithBackButton (the cramped element is the FeedSelector, which only renders when a feed exists), and a header-wide change would touch every consumer for a bug that lives on one page.

shivang-goliyan avatar Jun 30 '26 15:06 shivang-goliyan

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 16:04:07 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Workspace > Expensify Card page, the row that shows the card feed name ("Expensify Card") on the left and the "Issue card" / "More" buttons on the right has no guaranteed spacing between them.

  • When the browser window is narrowed (but still wide enough to keep both on the same line), the gap between the card name and the Issue card button collapses to almost nothing.
  • When the screen width hits the "medium" (tablet) breakpoint, the elements stack vertically but have zero vertical space between them, looking cramped.

What is the root cause of that problem?

The feed name and the action buttons are laid out inside a single flex container in WorkspaceExpensifyCardListPage.

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L294-L304

There are two distinct layout issues going on here:

  1. Horizontal collapse on wide screens: The row uses justifyContentBetween but has no gap. With justifyContent: 'space-between', the visible gap between the two children only exists as long as there is leftover free space. As the window narrows, the FeedSelector (which is flexShrink1) consumes available space. Once it fills the row, space-between has no free space to distribute, and the elements touch horizontally.
  2. Vertical collapse on medium screens: When the screen hits the isMediumScreenWidth breakpoint, the layout automatically drops flexRow and stacks the elements vertically. However, the top margin intended to separate them vertically (shouldShowSelector && shouldDisplayButtonsInSeparateLine && styles.mt3) relies on shouldDisplayButtonsInSeparateLine, which is only true on narrow (mobile) screens, not medium screens. Because there's no vertical margin applied and no gap on the container, the elements touch vertically.

What changes do you think we should make in order to solve the problem?

We can elegantly fix both issues by applying a universal gap to the parent container, which works in both flex directions (horizontal and vertical).

  1. Add styles.gap3 as a permanent style to the parent View wrapping the selector and the buttons:
                    style={[
                        styles.w100,
                        styles.ph5,
                        styles.pb3,
                        styles.gap3, // Add gap3 here universally
                        (!shouldChangeLayout || isInLandscapeMode) && [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween],
                    ]}
  1. Remove the conditional marginTop logic from the action buttons themselves in getHeaderButtons:
        const headerButtonsRowStyle = [
            styles.flexRow,
            styles.gap2,
            !shouldShowSelector && shouldDisplayButtonsInSeparateLine && styles.mb3,
            // REMOVE: shouldShowSelector && shouldDisplayButtonsInSeparateLine && styles.mt3,
        ];

Because React Native flexbox gap works in both directions, it solves both problems at once:

  • Wide Screens (row): It acts as a minimum horizontal gap so the items never touch when they shrink.
  • Medium & Narrow Screens (stacked): It acts as a vertical gap, applying exactly 12px of space between the Feed Selector and the buttons without needing brittle conditional margins.
Image

What alternative solutions did you explore? (Optional)

We could have fixed the medium screen issue by changing the condition for styles.mt3 to include medium screens, and fixed the horizontal issue by adding styles.gap3 conditionally just for the flexRow. However, leveraging a universal flex gap is much cleaner since it handles both layout directions gracefully and lets us delete the confusing conditional margin code entirely.

MobileMage avatar Jun 30 '26 15:06 MobileMage

Proposal

What is the root cause of that problem?

On the Workspace > Expensify Card page, when there is at least one Expensify Card feed we render the feed-selector header row that holds the card-feed name label on the left and the Issue card/More buttons on the right:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L294-L305

In the wide/landscape layout this container is laid out as [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween] — but it has no gap between its two children:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L295

The FeedSelector on the left is flexShrink1, so it shrinks to make room for the buttons as the row narrows (the feed-name Text is also flexShrink1 + numberOfLines={1}):

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/components/FeedSelector.tsx#L46-L60

justifyContentBetween only distributes the free space in the row. While the window is wide there is plenty of free space, so the label and the buttons look well separated. As the window narrows, the free space disappears, the FeedSelector shrinks right up against the Issue card button, and because there is no minimum gap reserved between them the spacing collapses to ~0 — the cramped UI in the report.

The sibling Company Cards header renders the exact same FeedSelector-on-the-left / buttons-on-the-right row, and it does not have this problem because its container reserves a styles.gap5 between the two sides:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/components/Tables/WorkspaceCompanyCardsTable/WorkspaceCompanyCardsTableHeaderButtons.tsx#L129-L136

So: narrow window → no free space for justifyContentBetween to distribute → FeedSelector shrinks flush against the buttons → no minimum gap is reserved → insufficient spacing between the card name label and the Issue card button.

What changes do you think we should make in order to solve the problem?

Reserve a minimum horizontal gap on the header row, exactly like the working Company Cards header already does with styles.gap5. The fix is one style addition to the conditional row array at WorkspaceExpensifyCardListPage.tsx#L295:

- <View style={[styles.w100, styles.ph5, styles.pb3, (!shouldChangeLayout || isInLandscapeMode) && [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween]]}>
+ <View style={[styles.w100, styles.ph5, styles.pb3, (!shouldChangeLayout || isInLandscapeMode) && [styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween, styles.gap5]]}>

gap reserves a guaranteed spacing between the two children before justifyContentBetween distributes any remaining free space, so the label and buttons stay separated at every window width while the FeedSelector’s flexShrink1 still lets the label truncate as needed. Placing it inside the existing row-only conditional means the stacked (narrow, non-landscape) layout is untouched — zero regression. This mirrors the proven sibling pattern (styles.gap5) so spacing is consistent across both card pages.

What alternative solutions did you explore? (Optional)

Adding a fixed styles.mr*/styles.pr* to the FeedSelector wrapper. It works, but it bakes spacing into one child instead of the row, doesn’t match how the Company Cards header solves the same problem, and is less robust if the button side changes — gap5 on the shared container is the cleaner, consistent fix. Minor refinements (exact gap size) can be discussed in the PR phase.

yusufdeveloper2903 avatar Jun 30 '26 15:06 yusufdeveloper2903

Note: This isn't a duplicate — the proposal it was flagged against was posted before the Help Wanted label (2026-06-30T15:22:05Z, before 2026-06-30T15:22:06Z), so it isn't a valid earlier proposal.

Proposal

What is the root cause of that problem?

On the Expensify Card page, when a feed selector is shown, the FeedSelector (card name + description) and the header buttons are laid out side‑by‑side in a flexRow whose only horizontal separation comes from justifyContentBetween — the row defines no gap:

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L294-L304

justifyContentBetween only produces space when there is free room in the row. The FeedSelector is flexShrink1 (it can shrink but otherwise grows to its natural content width, and its supporting description text can be long):

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/components/FeedSelector.tsx#L46-L48

So as the window narrows, the selector consumes the remaining free space → justifyContentBetween has nothing left to distribute → the card name label ends up directly against the Issue card button with no guaranteed minimum spacing.

What changes do you think we should make in order to solve the problem?

Add an explicit horizontal gap to the row container that holds the FeedSelector and the header buttons, so a minimum spacing is always preserved regardless of window width. In the wrapping View:

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L295

include styles.gap2 (or gap4) in the same conditional branch that applies flexRow/justifyContentBetween. A gap is honored even when the row is full, guaranteeing the buttons never touch the label.

What alternative solutions did you explore? (Optional)

Add a right margin (e.g. styles.mr2) to the FeedSelector wrapper, or wrap the buttons with styles.flexShrink0 plus left margin. These work but the gap on the shared row is the cleaner single fix and avoids touching the reusable FeedSelector.

lorretheboy avatar Jun 30 '26 15:06 lorretheboy

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 15:35:10 UTC.

Proposal

What is the root cause of that problem?

The Expensify Card page uses one responsive condition to decide when the feed selector and header buttons should stop sharing a horizontal row: shouldChangeLayout is true for medium-width web and narrow layouts. In that stacked state, the FeedSelector renders first and getHeaderButtons() renders immediately after it.

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L86-L88

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L295-L303

The spacing for that returned button row is controlled by a different condition. headerButtonsRowStyle only adds the selector top margin when shouldDisplayButtonsInSeparateLine is true, but that hook only returns true for narrow portrait layouts.

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L194-L198

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/hooks/useShouldDisplayButtonsInSeparateLine.ts#L7-L9

Medium-width web is a separate responsive state between the mobile and tablet breakpoints, so the selector/buttons can stack while shouldDisplayButtonsInSeparateLine is still false. That leaves no intended vertical gap between the card name area and the Issue card button at the resized desktop widths shown in the issue media.

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/hooks/useResponsiveLayout/index.ts#L32-L33

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/styles/variables.ts#L104-L105

What changes do you think we should make in order to solve the problem?

In WorkspaceExpensifyCardListPage, add a page-local boolean for the feed selector/header-button stack state, based on the same condition that makes the selector section stop using the wide row layout. For example, derive something like shouldStackFeedSelectorAndButtons from shouldShowSelector, shouldChangeLayout, and !isInLandscapeMode.

Use that stack-state boolean for the selector path spacing instead of relying only on shouldDisplayButtonsInSeparateLine. Concretely, when the feed selector and getHeaderButtons() are stacked, add the existing top margin or an equivalent parent gap between them. If the Issue card and Settings controls should stretch in that stacked selector layout, use the same boolean for their flex styles too.

Keep the existing shouldDisplayButtonsInSeparateLine behavior for the no-selector HeaderWithBackButton path, and keep the current large-width row layout unchanged. This fixes the cramped medium-width desktop layout without changing unrelated headers that use the generic hook.

Test coverage: Manually verify Workspace > Expensify Card on web with a verified bank account and at least one card at large desktop width, medium resized width around 801-1024px, and narrow portrait width. Confirm the feed/card name area and Issue card button keep visible spacing in the stacked layout, while the large-width row still lays out correctly. If a component test is practical for this page, mock useResponsiveLayout() with isMediumScreenWidth: true and shouldUseNarrowLayout: false, then assert the selector/action stack receives the spacing condition.

What alternative solutions did you explore? (Optional)

We could update useShouldDisplayButtonsInSeparateLine() to return true for medium-width web globally, but that hook is shared by unrelated workspace and money request headers. A page-local stack condition is safer because this bug comes from the Expensify Card page using one condition to stack the selector and another condition to space the buttons.

KJ21-ENG avatar Jun 30 '26 15:06 KJ21-ENG

Proposal

Please re-state the problem that we are trying to solve in this issue.

When viewing Workspace > Expensify Card with multiple card feeds (causing the feed selector to appear), and the browser window is resized to a narrower-but-still-wide width, the gap between the Card name label (inside the FeedSelector) and the "Issue card" button shrinks until they appear cramped with insufficient spacing.

What is the root cause of that problem?

The container that holds the FeedSelector and the header buttons uses flexRow + justifyContentBetween whenever the layout is "wide" (!shouldChangeLayout, i.e., not narrow and not medium width) OR in landscape mode. However, the FeedSelector only receives flex1 via wrapperStyle when isInLandscapeMode is true — the non-landscape wide layout case is left out.

The outer container applies flexRow + justifyContentBetween when !shouldChangeLayout || isInLandscapeMode, but the FeedSelector is only given flex1 for the isInLandscapeMode half of that condition:

https://github.com/Expensify/App/blob/a9199d66265f4ef34c1f4f5a62378a991de19025/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L295-L304

Without flex1, the FeedSelector wrapper relies solely on its internal flexShrink1 (set inside FeedSelector.tsx at line 48). In a flexRow + justifyContentBetween parent, flexShrink1 means the selector only occupies the space its content needs and shrinks as the window narrows — instead of growing to fill available space and maintaining a stable gap before the button. As the window gets narrower (while still in "wide" layout mode), the card name and the Issue card button are pushed progressively closer together.

The internal wrapperStyle application in FeedSelector confirms the flex behaviour:

https://github.com/Expensify/App/blob/a9199d66265f4ef34c1f4f5a62378a991de19025/src/components/FeedSelector.tsx#L46-L51

flexShrink1 without a corresponding flex1 or flexGrow1 means the element shrinks freely but never expands to fill space, causing the spacing problem on wide-but-narrowing windows.

What changes do you think we should make in order to solve the problem?

Extend the flex1 condition on the FeedSelector's wrapperStyle to match the outer View's flexRow condition. Currently only isInLandscapeMode triggers flex1; it should be !shouldChangeLayout || isInLandscapeMode — the same predicate used by the parent to enter row layout:

https://github.com/Expensify/App/blob/a9199d66265f4ef34c1f4f5a62378a991de19025/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L297

wrapperStyle={(!shouldChangeLayout || isInLandscapeMode) ? styles.flex1 : undefined}

This ensures that whenever the container is in flexRow mode (both wide desktop and landscape), the FeedSelector fills the available horizontal space and keeps the Issue card button consistently separated to the right edge.

abbasifaizan70 avatar Jun 30 '26 15:06 abbasifaizan70

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)

melvin-bot[bot] avatar Jun 30 '26 15:06 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

When the Expensify Card page is resized to a narrower desktop width, the Issue card button is displayed too close to the Card name table header.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx, the Issue card button switches to the shouldDisplayButtonsInSeparateLine layout and receives styles.flex1, but that responsive branch does not add sufficient bottom spacing before the card-list header rendered below it.

What changes do you think we should make in order to solve the problem?

Update the Issue card action container in WorkspaceExpensifyCardListPage to apply an appropriate bottom margin when shouldDisplayButtonsInSeparateLine is true. This will preserve the existing wide-screen layout while maintaining consistent separation from the Card name header after resizing.

What alternative solutions did you explore? (Optional)

Adding spacing to WorkspaceCardListHeader would also separate the elements, but it would affect the table header in every layout. Scoping the margin to the responsive action-row branch keeps the change limited to the failing state.

kitvasyl avatar Jun 30 '26 15:06 kitvasyl

Proposal

What is the root cause of that problem?

The "Card name" label in the screenshot is the FeedSelector (feed name + supporting text), and the "Issue card" button comes from getHeaderButtons(). Both live in the same row container on the card list page:

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L294-L305

When the layout is wide enough that !shouldChangeLayout || isInLandscapeMode is true, that View becomes flexRow + alignItemsCenter + justifyContentBetween. There is no gap on the row, and the FeedSelector is only given a flex constraint when isInLandscapeMode is true:

https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L296-L302

On a regular desktop browser isInLandscapeMode is false, so wrapperStyle is undefined. That means the FeedSelector takes its natural content width with no flexShrink and no maxWidth, while justifyContentBetween just pushes the two ends apart with whatever free space is left over. As you drag the window narrower (but still above the medium-width breakpoint where shouldChangeLayout would flip the layout to stacked), the free space between the feed name and the button keeps shrinking toward zero with no minimum spacing enforced — that's the cramped look in the video. The only thing keeping them apart is leftover free space, which disappears at narrow-but-still-wide widths.

What changes do you think we should make in order to solve the problem?

This is a style/render fix in the row at WorkspaceExpensifyCardListPage.tsx line 294-305.

Two changes:

  1. Add a horizontal gap to the row when it's in the flexRow branch (e.g. include styles.gap3 alongside styles.flexRow/styles.alignItemsCenter/styles.justifyContentBetween). This guarantees a minimum spacing regardless of how the free space collapses.

  2. Give the FeedSelector a flexShrink/flex1 wrapper style in the wide (non-landscape) row case too, not just isInLandscapeMode. Right now wrapperStyle is undefined off-landscape, so the feed name never yields space to the button. Letting it shrink (and truncate) means the button keeps its size and the gap holds.

Keeping the gap is the important half: even with the flex constraint, without a gap the truncated text would still sit flush against the button.

What alternative solutions did you explore? (Optional)

Constrain the FeedSelector with a fixed maxWidth instead of letting it flex-shrink. Rejected: a hardcoded width doesn't adapt across the whole wide-to-medium window range and would either waste space on large screens or still crowd at the low end — the same brittleness that produced this bug. The flex + gap approach scales across the entire range.

I also considered lowering the breakpoint so the buttons drop to a separate line sooner (the shouldDisplayButtonsInSeparateLine path already exists for narrow widths). Rejected as out of scope: that changes the layout intent for a band of widths where the side-by-side row is the desired design, and the real defect is just the missing minimum spacing within that row.

oqildev avatar Jun 30 '26 15:06 oqildev

Job added to Upwork: https://www.upwork.com/jobs/~022071977612508637430

melvin-bot[bot] avatar Jun 30 '26 15:06 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

[$250] Insufficient spacing between Card name and Issue card button when window is resized

What is the root cause of that problem?

I traced this to the path that handles the issue-specific state:

What changes do you think we should make in order to solve the problem?

  • Update src/pages/workspace/expensifyCard/DynamicExpensifyCardNamePage.tsx:75 to derive the issue-specific state from the matched app state path that owns this flow before the value is consumed.
  • Carry the same normalized value through src/pages/workspace/expensifyCard/DynamicExpensifyCardNamePage.tsx:77; that follows the safer family move to add a local hasEverLoaded/hasInteracted guard, so the write/optimistic/read paths agree instead of only changing the visible component.
  • Keep the change inside the UI, Forms, Lists, Accessibility surface and avoid changing platform-specific variants, screen reader behaviour.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  1. Add or update a regression in tests/components/**/*.ts for the exact issue flow: [$250] Insufficient spacing between Card name and Issue card button when window is resized.
  2. Cover the counter-case near src/pages/workspace/expensifyCard/DynamicExpensifyCardNamePage.tsx:75 so valid existing the issue-specific state behavior still works.
  3. Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.

What alternative solutions did you explore? (Optional)

  • I would not add a broad new condition outside these referenced paths; the safer fix is to keep the issue-specific state consistent at the first read/write boundary shown above.

⚠️ @lorretheboy Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Jun 30 '26 15:06 github-actions[bot]

Proposal

What is the root cause of that problem?

The Expensify Card page renders the FeedSelector (card name) and header buttons (Issue card / More) inside a single container. This container switches between a horizontal row and a vertical stack using shouldChangeLayout line 94 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L94 which is true for medium-width and narrow layouts. When in row mode, the container uses justifyContentBetween but defines no gap line 314 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L314 Since the FeedSelector is flexShrink1 FeedSelector.tsx:51 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/components/FeedSelector.tsx#L51 it shrinks to fill the row as the window narrows, leaving no free space for justifyContentBetween to distribute. The card name ends up flush against the button.

A secondary issue exists at medium widths 801–1024px: shouldChangeLayout stacks the elements vertically, but the vertical spacing condition relies on shouldDisplayButtonsInSeparateLine line 215 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L215 which only returns true for narrow portrait layouts useShouldDisplayButtonsInSeparateLine.ts:9 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/hooks/useShouldDisplayButtonsInSeparateLine.ts#L9 At medium width, the elements stack but get no vertical spacing.

The sibling Company Cards page avoids both issues because its container already reserves a styles.gap5 WorkspaceCompanyCardsTableHeaderButtons.tsx:136 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/components/Tables/WorkspaceCompanyCardsTable/WorkspaceCompanyCardsTableHeaderButtons.tsx#L136

What changes do you think we should make in order to solve the problem?

Add styles.gap5 to the parent container at line 314 https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L314 outside the row conditional, and remove the now-redundant conditional mt3 from headerButtonsRowStyle at [line 215] https://github.com/Expensify/App/blob/371c63dd33c770f0b2ab6d592d557156c66860ad/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L215

React Native gap is directional-agnostic — it adds spacing in whatever direction the flex container runs. In the wide row layout, gap5 provides a 20px minimum horizontal gap between the FeedSelector and the buttons before justifyContentBetween distributes leftover free space. In the stacked layout medium/narrow, gap5 provides 20px vertical spacing between the two elements. This matches the Company Cards header's styles.gap5 value, keeping both card pages visually consistent.

Removing the shouldShowSelector && shouldDisplayButtonsInSeparateLine && styles.mt3 entry avoids double-spacing on narrow portrait, where both gap5 and mt3 would otherwise apply.

What alternative solutions did you explore? (Optional)

  • Scoped gap inside the row-only conditional: Adding gap5 only when !shouldChangeLayout || isInLandscapeMode fixes the horizontal collapse but leaves the medium-width vertical collapse unfixed, since the gap wouldn't apply when the row conditional is false.
  • Universal gap3 (12px) instead of gap5 (20px): Works for both directions, but creates tighter spacing than the Company Cards sibling page for no reason. gap5 maintains visual consistency.
  • Adding margin to the FeedSelector wrapper: Bakes spacing into a reusable component instead of the page container. The FeedSelector is shared — adding margin there would affect every consumer.
  • Creating a page-local boolean to replace shouldDisplayButtonsInSeparateLine: Over-engineered. A CSS gap does the job without adding derived state that must be kept in sync with existing conditions.
  • Extending flex1 on FeedSelector: flex1 redistributes available space but doesn't add minimum spacing. The gap between items remains 0.
  • Modifying useShouldDisplayButtonsInSeparateLine to cover medium width: Shared hook used by other workspace pages — changing its semantics would cascade regressions.

Fixed Demo:

https://github.com/user-attachments/assets/f5e2c498-8cf2-47ec-b13e-cbfba98215d3

x-dev90 avatar Jun 30 '26 15:06 x-dev90

Proposal

What is the root cause of that problem?

On Workspace > Expensify Card (with a feed selector), the feed name (FeedSelector) and the Issue card / More buttons share a responsive header section. Two different breakpoints control that section:

Stack vs row — the wrapper uses shouldChangeLayout (isMediumScreenWidth || shouldUseNarrowLayout) to decide when to stop laying out feed + buttons in a horizontal row:

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L86-L87

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L297

When shouldChangeLayout is true (medium-width web or narrow layout), the row stacks vertically: FeedSelector on top, getHeaderButtons() directly below.

Spacing when stacked — headerButtonsRowStyle only adds styles.mt3 between the feed name and buttons when shouldDisplayButtonsInSeparateLine is true:

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx#L199-L200

But shouldDisplayButtonsInSeparateLine is only true for narrow portrait (shouldUseNarrowLayout && !isInLandscapeMode):

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/hooks/useShouldDisplayButtonsInSeparateLine.ts#L7-L9

Medium-width desktop (isMediumScreenWidth true, shouldUseNarrowLayout false) is a distinct breakpoint: the feed selector and buttons stack (shouldChangeLayout true) but shouldDisplayButtonsInSeparateLine stays false. No mt3 is applied, so the card name and Issue card button render with insufficient vertical spacing — matching the issue repro when resizing to a narrower (but not yet mobile-narrow) width.

The generic shouldDisplayButtonsInSeparateLine hook is still correct for the no-selector path (buttons inside HeaderWithBackButton vs below it). The bug is using that hook for feed-selector spacing when the stack decision is driven by shouldChangeLayout.

What changes do you think we should make in order to solve the problem?

In getHeaderButtons, use the same stack state as the feed-selector wrapper for selector-path spacing. Replace shouldDisplayButtonsInSeparateLine with shouldChangeLayout && !isInLandscapeMode (equivalent to when the wrapper is not using flexRow) for the selector-specific margin rules:

  • shouldShowSelector && shouldChangeLayout && !isInLandscapeMode && styles.mt3 on the button row here
  • style={shouldChangeLayout && styles.flex1} on the issue card button here
  • Keep shouldDisplayButtonsInSeparateLine for the no-selector HeaderWithBackButton path and for button flex styles that only apply in narrow portrait

Leave the wrapper flexRow condition on !shouldChangeLayout || isInLandscapeMode unchanged.

What alternative solutions did you explore? (Optional)

— change the wrapper flexRow guard from !shouldChangeLayout to !shouldDisplayButtonsInSeparateLine so medium width keeps a horizontal row instead of stacking. This avoids the missing vertical margin but changes layout at medium breakpoints and may still need a horizontal gap if the side-by-side row becomes cramped (see Company Cards header styles.gap5 pattern).

nkdengineer avatar Jun 30 '26 15:06 nkdengineer

Proposal Updated

Image

MobileMage avatar Jun 30 '26 16:06 MobileMage

🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

simon576work-web avatar Jun 30 '26 16:06 simon576work-web

📣 @simon576work-web! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Jun 30 '26 16:06 melvin-bot[bot]

⚠️ @simon576work-web Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Jun 30 '26 16:06 github-actions[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01d0113b977cfcc66c

Please re-state the problem that we are trying to solve in this issue.

On Workspace > Expensify Card (when the feed selector is shown), resizing the browser causes the card feed name and the Issue card button to sit too close together — either horizontally (while they still share a row) or vertically (at medium widths where they stack).

What is the maincause of that problem?

The feed name (FeedSelector) and action buttons (getHeaderButtons()) share one parent View in WorkspaceExpensifyCardListPage. Layout and spacing for that container are controlled by two different responsive conditions that fall out of sync:

  • Stack vs row uses shouldChangeLayout (isMediumScreenWidth || shouldUseNarrowLayout).
  • Vertical spacing when stacked uses shouldDisplayButtonsInSeparateLine, which is only true for narrow portrait (shouldUseNarrowLayout && !isInLandscapeMode).

The parent container applies flexRow + justifyContentBetween when !shouldChangeLayout || isInLandscapeMode, but defines no gap. Horizontal separation therefore depends entirely on leftover free space. FeedSelector is flexShrink1, so as the window narrows the free space disappears and the label meets the button.

At medium widths (801–1024px), shouldChangeLayout stacks the selector and buttons vertically, but shouldDisplayButtonsInSeparateLine stays false, so the mt3 margin on the button row is never applied. The stacked layout has no vertical spacing.

The sibling Company Cards header avoids both problems by placing styles.gap5 on the parent container outside the row conditional (WorkspaceCompanyCardsTableHeaderButtons.tsx). Expensify Card is missing that same style.

What changes do you think we should make in order to solve the problem?

In WorkspaceExpensifyCardListPage.tsx:

  1. Add styles.gap5 to the FeedSelector/buttons parent View unconditionally (alongside styles.w100, styles.ph5, styles.pb3), matching the Company Cards header pattern. This guarantees spacing in both row and stacked layouts.
  2. Remove shouldShowSelector && shouldDisplayButtonsInSeparateLine && styles.mt3 from headerButtonsRowStyle — parent gap5 replaces this brittle, mismatched margin. Keep the no-selector mb3 rule unchanged.
  3. Update FeedSelector wrapperStyle from landscape-only flex1 to (!shouldChangeLayout || isInLandscapeMode) ? styles.flex1 : undefined so the feed name truncates properly in all row layouts while the gap holds.

simon576work-web avatar Jun 30 '26 16:06 simon576work-web