You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] Display options icon (eyeball) is missing from some mobile tables like Per diem #107274
**Version Number:**9.5.41-0 Reproducible in staging?: Yes Reproducible in production?: Yes 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:@shawnborton Slack conversation (hyperlinked to channel name): expensify_bugs
changed the title [-]Display options icon (eyeball) is missing from some mobile tables like Per diem[/-][+][$175] Display options icon (eyeball) is missing from some mobile tables like Per diem[/+]on Nov 18, 2026
Per diem and Taxes explicitly force alphabetical sorting in narrow and medium layouts. The shared Display options component hides itself whenever that sorting lock is active—even though an eyeball button is already implemented.
Confidence: Medium. Confirmed in current code; not reproduced in the browser or checked against version 9.5.41-0.
What changes do you think we should make in order to solve the problem?
Remove narrowLayoutSortColumn from these two tables, retaining initialSortColumn. This enables the existing eyeball control and functional sorting, while preserving alphabetical order initially.
Confirm that mobile sorting is intended to replace the existing lock. Verify populated Per diem and Taxes tables at narrow, medium, and wide widths; test sort field, direction, reset, and resizing. Preserve empty-table behavior.
What alternative solutions did you explore? (Optional)
Changing the shared visibility guard alone would expose an ineffective control and affect other tables with intentional sorting locks.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/107274) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
On narrow (mobile) layouts, the Display options (eyeball) button is missing from some workspace tables, such as Per diem and Taxes, so users can't change how the table is sorted there.
What is the root cause of that problem?
This is caused by the shared Table component's narrowLayoutSortColumn prop, not by anything in a single page. When a table passes that prop and shouldUseNarrowTableLayout is true:
The sorting middleware ignores the user's sort and forces {columnKey: narrowLayoutSortColumn, order: ASC}:
Because sorting is locked, shouldShowTableDisplaySettingsTrigger hides the eyeball on purpose (isSortingLockedByLayout). The filter bar uses the same check:
In every one of them, narrowLayoutSortColumn has the same value as initialSortColumn. So the prop doesn't change the default order. Its only effect is to lock sorting and hide the eyeball on mobile.
What changes do you think we should make in order to solve the problem?
Remove narrowLayoutSortColumn from all six tables above. Keep initialSortColumn, so the default mobile order stays the same (alphabetical by name, destination, card, or condition).
Once nothing uses it, remove the lock from the shared Table: the narrowLayoutSortColumn branch in resolveActiveSorting (narrow layout keeps returning userSorting, as it already does for tables without the prop), the isSortingLockedByLayout check in shouldShowTableDisplaySettingsTrigger, and the prop/context field in types.ts, TableContext.tsx and Table.tsx. Then no other table can hit this bug again.
After this, narrow layouts behave like the tables that already show the eyeball on mobile: the eyeball opens Sort by / Sort order, and the choice is applied.
How this differs from the existing MelvinBot proposal
Melvin's proposal finds the same mechanism but only changes Per diem and Taxes. Distance rates, Spend rules, Category rules and Expense defaults have the same narrowLayoutSortColumn and would still be missing the eyeball on mobile (the issue says "some mobile tables like Per diem"). This proposal fixes all six and removes the now-unused lock, so the bug can't come back through that prop.
What specific scenarios should we cover in automated tests to prevent reoccurrence of this issue?
Unit test for shouldShowTableDisplaySettingsTrigger: it returns true on a narrow layout whenever the table has at least one sortable column.
Unit test for the sorting middleware: on a narrow layout, after updateSorting({columnKey: 'rate', order: 'desc'}), activeSorting equals the user's choice, and the initial order is initialSortColumn ascending.
What alternative solutions did you explore? (Optional)
Keep the prop but treat it as a default only (use it until the user picks a sort, then respect the user's choice). That works too, but it duplicates initialSortColumn in every current use, so removing it is simpler.
Please re-state the problem that we are trying to solve in this issue.
On narrow and medium (mobile/tablet) layouts, the Display options (eyeball) trigger is missing from several workspace tables — including Per diem, Taxes, Distance rates, Spend rules (Card restrictions), Category rules, Require fields, and Expense defaults — preventing users from changing the sort column or sort direction on mobile.
What is the root cause of that problem?
There are three coupled issues across Table, WorkspaceTaxesTable, and sorting.ts (which is why simply deleting narrowLayoutSortColumn alone introduces a sort/UI desynchronization on Taxes and on conditional columns in narrow layouts):
narrowLayoutSortColumn locks sorting and hides the eyeball across 6 table components (7 workspace screens): WorkspacePerDiemTable (index.tsx:156), WorkspaceTaxesTable (index.tsx:164), WorkspaceDistanceRatesTable (index.tsx:215), WorkspaceSpendRulesTable (index.tsx:118), WorkspaceCategoryRulesTable (index.tsx:121, which also powers WorkspaceRequireFieldsTable), and WorkspaceExpenseDefaultsTable (index.tsx:131) all pass narrowLayoutSortColumn with the exact same column as initialSortColumn.
When shouldUseNarrowTableLayout (shouldUseNarrowLayout || isMediumScreenWidth) is true:
shouldShowTableDisplaySettingsTrigger (src/components/Table/TableFilterBar/TableDisplaySettingsTrigger.tsx:32-37 and TableFilterBar/index.tsx:34) sets isSortingLockedByLayout = shouldUseNarrowTableLayout && !!narrowLayoutSortColumn and hides the eyeball button.
resolveActiveSorting (src/components/Table/middlewares/sorting.ts:106-111) overrides userSorting with {columnKey: narrowLayoutSortColumn, order: CONST.SEARCH.SORT_ORDER.ASC}.
WorkspaceTaxesTable strips taxCode from taxTableColumns on narrow layouts (src/components/Tables/WorkspaceTaxesTable/index.tsx:59-60, 86):
Unlike WorkspaceCategoriesTable (index.tsx:76-92), WorkspaceTagsTable (index.tsx:100-118), WorkspaceMembersTable (index.tsx:138-184), and WorkspaceDistanceRatesTable (index.tsx:86-99) — which all keep their conditional sortable columns in columns whenever the workspace has data for them while hiding the visual cell inside the *TableRow component — WorkspaceTaxesTable/index.tsx:60,86 gates taxTableColumns on shouldShowTaxCodeCell (!shouldUseNarrowTableLayout && shouldShowTaxCodeColumn) instead of shouldShowTaxCodeColumn.
On narrow/medium layouts, TableHeader.tsx:192 (!shouldUseNarrowTableLayout), TableRow.tsx:227 (!shouldUseNarrowTableLayout CSS grid), useDynamicColumnWidths (Table.tsx:281), and shouldUseTableSemantics (tableAccessibility.ts:150-152, aria-colcount) are all already disabled, and WorkspaceTaxesTableRow.tsx:66 independently computes its own shouldShowTaxCodeCell for the card layout and accessibilityLabel.
If narrowLayoutSortColumn is removed without changing WorkspaceTaxesTable/index.tsx:86 to shouldShowTaxCodeColumn, sorting Taxes by Tax code (Descending) on wide layout and resizing to narrow keeps activeSorting = {columnKey: 'taxCode', order: 'desc'} while TableDisplaySettingsPopoverComponent.tsx:95 (sortableColumns.find(...) ?? sortableColumns.at(0)) falls back to Name • Descending — displaying a false sort label in the eyeball menu while rows remain ordered by taxCode, and preventing mobile users from sorting by Tax code.
Narrow-layout bypass in resolveActiveSorting (sorting.ts:106-117) & cleared-column fallback in TableDisplaySettingsPopoverComponent.tsx:95:
Once WorkspaceTaxesTable uses shouldShowTaxCodeColumn (matching every other workspace table; WorkspaceTagsTable only gates tagCount which has sortable: false), no table drops sortable columns solely for narrow layout. Keeping if (shouldUseNarrowTableLayout) { return userSorting; } in resolveActiveSorting (sorting.ts:106-110) skips the missing-column fallback at lines 114-116 (if (userSorting.columnKey && !columnKeys.includes(userSorting.columnKey))), leaving narrow tables sorted by a deleted conditional column (e.g. after removing the last date-bounded rate in Distance rates) instead of resetting to {columnKey: initialSortColumn, order: initialSortOrder}.
In TableDisplaySettingsPopoverComponent.tsx:95, resolving activeColumn via activeSorting.columnKey ?? defaultSorting.columnKey aligns sortByTitle with openSortBy() (line 114) when activeSorting.columnKey is undefined (after resetting a header on wide layout) on tables whose initialSortColumn (name, card, condition) is not sortableColumns.at(0) (status, type).
What changes do you think we should make in order to solve the problem?
Remove narrowLayoutSortColumn from the 6 workspace tables and the shared Table API:
Remove narrowLayoutSortColumn from WorkspacePerDiemTable, WorkspaceTaxesTable, WorkspaceDistanceRatesTable, WorkspaceSpendRulesTable, WorkspaceCategoryRulesTable (also fixing WorkspaceRequireFieldsTable), and WorkspaceExpenseDefaultsTable, preserving initialSortColumn.
Remove narrowLayoutSortColumn and isSortingLockedByLayout from src/components/Table/types.ts, TableContext.tsx, Table.tsx, TableDisplaySettingsTrigger.tsx, TableFilterBar/index.tsx, and middlewares/sorting.ts.
Keep taxCode sortable on narrow layouts in WorkspaceTaxesTable (src/components/Tables/WorkspaceTaxesTable/index.tsx:59-60, 86):
Gate the taxCode entry in taxTableColumns on shouldShowTaxCodeColumn (matching WorkspaceCategoriesTable), leaving WorkspaceTaxesTableRow.tsx:66 (shouldShowTaxCodeCell) untouched so narrow card layout and VoiceOver/TalkBack labels remain unchanged.
Unify resolveActiveSorting and TableDisplaySettingsPopoverComponent fallback:
In src/components/Table/middlewares/sorting.ts, remove the if (shouldUseNarrowTableLayout) early return in resolveActiveSorting so conditional columns removed from columnKeys cleanly fall back to {columnKey: initialSortColumn, order: initialSortOrder} on all screen widths.
In src/components/Table/TableFilterBar/TableDisplaySettingsPopoverComponent.tsx:95, match activeColumn against activeSorting.columnKey ?? defaultSorting.columnKey before falling back to sortableColumns.at(0).
Automated tests:
Extend tests/unit/components/Table/useSortingTest.ts and tests/ui/TableTest.tsx to cover: (a) eyeball visibility and interactive sorting (Sort by + Sort order + Reset) on narrow/medium layouts, (b) WorkspaceTaxesTable wide-to-narrow resize while sorted by taxCode preserving both row order and Tax code label without rendering a taxCode cell on narrow cards, and (c) narrow-layout fallback to initialSortColumn when a conditional column disappears from columnKeys.
What alternative solutions did you explore? (Optional)
Removing narrowLayoutSortColumn without updating WorkspaceTaxesTable (taxTableColumns) and resolveActiveSorting: Exposes the eyeball icon, but leaves Taxes unable to sort by Tax code on mobile, causes TableDisplaySettingsPopoverComponent to misreport Name when resizing from a desktop Tax code sort, and leaves narrow tables stuck on stale conditional sort keys when the underlying data loses that column.
@MelvinBot The root cause looks right, but please research this further and update the proposal to cover the following:
Scope:narrowLayoutSortColumn is set to the same value as initialSortColumn in four additional tables: WorkspaceDistanceRatesTable, WorkspaceSpendRulesTable, WorkspaceCategoryRulesTable (also used by Require fields), and WorkspaceExpenseDefaultsTable. The sort option is missing on narrow and medium layouts in these tables too. Please check each one and clarify whether it should be included in the fix. If any should remain locked, explain why.
Taxes regression after unlocking:WorkspaceTaxesTable includes the taxCode column only when !shouldUseNarrowTableLayout && shouldShowTaxCodeColumn. On narrow layouts, resolveActiveSorting in src/components/Table/middlewares/sorting.ts returns userSorting without falling back to another column.
This means that if a user sorts by Tax code (descending) on a wide layout and then resizes or rotates a tablet to a narrow layout, the rows remain sorted by Tax code, while the Display options popover shows "Name • Descending" (because TableDisplaySettingsPopoverComponent falls back to sortableColumns.at(0)).
The current lock hides this inconsistency, but removing it exposes the issue. Please confirm this behavior and propose a fix. Also check whether any other affected table removes a sortable column on narrow layouts.
Shared code: If no table uses narrowLayoutSortColumn after this change, please determine whether we should remove the prop, the context field, the isSortingLockedByLayout check, the corresponding branch in resolveActiveSorting, and the documentation in TABLE.md. List every file that would need to change. Also explain whether removing this logic would affect tables that don't currently use the lock.
Tests: List all unit tests that should be added or updated, including shouldShowTableDisplaySettingsTrigger, the sorting middleware tests, and the Taxes resize case.
narrowLayoutSortColumn deliberately forces ascending sorting and hides Display options on narrow and medium layouts. All six remaining consumers set it to their initialSortColumn.
Removing only the visibility check would expose a control whose selections the sorting middleware ignores. Removing only the table props would unlock sorting, but expose the Taxes resize inconsistency you identified.
Verification: Confirmed through code and introducing PR history; not reproduced in a browser, and no tests were executed.
What changes do you think we should make in order to solve the problem?
1. Include all six tables
Remove their locks while retaining initialSortColumn:
Table
Initial column retained
Recommendation
Per diem
destination
Unlock
Taxes
name
Unlock, with the column fix below
Distance rates
name
Unlock
Spend rules / Card restrictions
card
Unlock
Category rules
condition
Unlock; also fixes Require fields and Flag for review, which delegate to this table
Expense defaults
condition
Unlock
I found no technical requirement to keep any of these locked. Spend rules’ default-rule placement and Expense defaults’ section ordering are enforced independently by their comparators, so user sorting does not remove those safeguards.
Retaining initialSortColumn preserves the initial order. Resize behavior intentionally changes: a user’s selected wide-layout sort remains active instead of temporarily switching to the forced narrow-layout sort.
Why the locks were introduced—and whether those reasons still apply
I used git log -S narrowLayoutSortColumn, the introducing PRs and their reviews, and the table guide.
Added with the shared Rules table. No distinct mobile-lock rationale was found.
For the latter five tables, preserving the existing compact-list order is an inference, not a documented product decision.
The later Add bulk actions for company cards change introduced automatic Display controls but intentionally excluded locked narrow tables. The table guide:45 documents that exception: hiding the control avoids offering ineffective sorting.
The new control addresses the practical need for users to inspect/change their compact-layout sort; it does not automatically rescind the original restriction. Unlocking all six should therefore be an explicit scope decision.
2. Fix Taxes by retaining its logical Tax code column
Your resize analysis is correct after unlocking:
Wide layout stores taxCode / descending.
Narrowing removes taxCode from the columns.
The middleware preserves that user sort.
The Taxes comparator still sorts by Tax code.
The popover cannot find that column, substitutes Name, and retains Descending.
For example, rows Alpha/Z, Bravo/A, Charlie/M remain ordered Alpha, Charlie, Bravo, despite the menu saying Name • Descending.
Recommended fix: Include taxCode in the logical column definitions whenever shouldShowTaxCodeColumn is true, regardless of layout. Remove the parent’s now-unused layout-dependent cell condition. Keep the row component’s existing narrow-layout visual and accessibility hiding unchanged.
That preserves the selected sort, keeps Tax code available in Display options, and does not add a Tax code cell to narrow cards.
Of the six affected tables, only Taxes drops a sortable column because of layout. Distance rates has conditional tax/date columns, but those depend on workspace data/settings, not width; the other four have layout-independent column definitions.
3. Remove the obsolete lock API—but preserve the separate narrow-layout fallback policy
After removing these six assignments, no production consumer remains. Remove the prop, context field, middleware argument, forced-sort expression, visibility restriction, and documentation.
Important distinction: Do not silently delete the entire narrow-layout early return from resolveActiveSorting. Without a lock, that branch already preserves userSorting when its column is absent. Applying the wide-layout missing-column fallback everywhere would change existing unlocked tables too.
No wrapper, row-component, or popover change is required for this approach. Keep layout-dependent compact-button rendering and empty-table toolbar behavior.
Initial column/order; user-selected alternate column descending; actual processed order; wide → narrow → wide preservation; reset to defaults; cache invalidation on column changes. Explicitly preserve wide missing-column fallback and narrow stored-sort behavior. Test column reappearance and that derived fallback does not emit a user-change callback. Keep existing cache tests.
Parameterize wide, narrow, and medium-only layouts. Assert the accessible Display button exists on populated sortable tables without filters; Sort by/order Apply changes rows and summary; dismissing unapplied changes does not; Sort by Reset restores both defaults, while Sort order Reset preserves the column. Preserve no-sortable-column and empty-table visibility behavior.
New WorkspaceTaxesTableTest.tsx beside TableTest.tsx
Use real sorting/context and deliberately conflicting Name/Tax-code order. Select Tax code descending wide, resize the same mounted instance through medium/narrow/back wide, and assert actual rows, summary, and selected option remain Tax code descending. Test starting narrow/medium, changing direction, and resetting. Tax code remains selectable but its row cell/accessibility content stays hidden on compact layouts. With shouldShowTaxCodeColumn=false, it is absent from options at every width.
Remove obsolete lock-prop mock/capture/assertion; retain the initial Name-sort regression assertion.
What alternative solutions did you explore? (Optional)
Show the button only: rejected; sorting remains locked.
Remove the six assignments only: incomplete; exposes the Taxes mismatch and leaves unused shared API.
Apply missing-column fallback on every layout: potentially useful separately, but changes existing unlocked tables and unnecessarily resets Taxes’ chosen sort on resize.
Change only the popover label: insufficient; Tax code would still disappear from compact-layout sorting choices.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/107274) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.
Browser verification was blocked by a blank app page and unavailable session; this is not a confirmed product regression.
Step
Status
Verify compact Display options, Taxes resize sorting, and sorting/reset across affected tablesThe app rendered no inspectable content, so browser behavior could not be verified.
❌
Implemented and committed locally as e5bfd8b13b:
Unlocked all six tables and removed the unused lock API/documentation.
Preserved Tax code sorting across layouts without displaying compact Tax code cells.
Preserved existing fallback behavior for other tables.
Added sorting, visibility, reset, and resize regression coverage.
Checks: 248 targeted tests passed, along with lint, typecheck, formatting, and Storybook smoke tests. Code review found no actionable issues. The full test suite exceeded five minutes without completing.
No branch was pushed and no PR was created. The run reached its step limit after a shallow-history problem prevented finding the merge base; fetching more history timed out.
Remaining: restore sufficient Git history, verify the final diff, push the commit, and create the draft PR assigned to Krishna2323. Browser verification also remains blocked.
@MelvinBot implement this and open a draft PR assigned to me.
To stay within the run limit:
Skip browser verification. I'll test on the PR.
Run only the targeted tests (tests/unit/components/Table/useSortingTest.ts, tests/ui/TableTest.tsx, and the new Taxes and trigger tests), plus lint and typecheck on changed files. Don't run the full suite.
Branch from the latest origin/main and don't compute a merge base or fetch full history. If you need a diff, compare against origin/main directly.
Push and open the draft PR as soon as the targeted checks pass. Leave QA steps and screenshots for me.
Activity
expensify-chore-bot commentedon Nov 18, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @gijoe0295 (
External)[-]Display options icon (eyeball) is missing from some mobile tables like Per diem[/-][+][$175] Display options icon (eyeball) is missing from some mobile tables like Per diem[/+]expensify-chore-bot commentedon Nov 18, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022123077415725097415
MelvinBot commentedon Nov 18, 2026
Proposal
What is the root cause of that problem?
Per diem and Taxes explicitly force alphabetical sorting in narrow and medium layouts. The shared Display options component hides itself whenever that sorting lock is active—even though an eyeball button is already implemented.
Confidence: Medium. Confirmed in current code; not reproduced in the browser or checked against version 9.5.41-0.
Code evidence and alternatives checked
narrowLayoutSortColumn: Per diem:141–159, Taxes:155–175.What changes do you think we should make in order to solve the problem?
Remove
narrowLayoutSortColumnfrom these two tables, retaininginitialSortColumn. This enables the existing eyeball control and functional sorting, while preserving alphabetical order initially.Confirm that mobile sorting is intended to replace the existing lock. Verify populated Per diem and Taxes tables at narrow, medium, and wide widths; test sort field, direction, reset, and resizing. Preserve empty-table behavior.
What alternative solutions did you explore? (Optional)
Changing the shared visibility guard alone would expose an ineffective control and affect other tables with intentional sorting locks.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/107274)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
akzkid commentedon Nov 18, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On narrow (mobile) layouts, the Display options (eyeball) button is missing from some workspace tables, such as Per diem and Taxes, so users can't change how the table is sorted there.
What is the root cause of that problem?
This is caused by the shared
Tablecomponent'snarrowLayoutSortColumnprop, not by anything in a single page. When a table passes that prop andshouldUseNarrowTableLayoutis true:{columnKey: narrowLayoutSortColumn, order: ASC}:App/src/components/Table/middlewares/sorting.ts
Lines 107 to 111 in 94337cb
shouldShowTableDisplaySettingsTriggerhides the eyeball on purpose (isSortingLockedByLayout). The filter bar uses the same check:App/src/components/Table/TableFilterBar/TableDisplaySettingsTrigger.tsx
Lines 32 to 37 in 94337cb
App/src/components/Table/TableFilterBar/index.tsx
Line 34 in 94337cb
Six tables pass
narrowLayoutSortColumntoday, so the eyeball is missing on mobile in all six, not just Per diem and Taxes:App/src/components/Tables/WorkspacePerDiemTable/index.tsx
Lines 155 to 156 in 94337cb
App/src/components/Tables/WorkspaceTaxesTable/index.tsx
Lines 163 to 164 in 94337cb
App/src/components/Tables/WorkspaceDistanceRatesTable/index.tsx
Lines 214 to 215 in 94337cb
App/src/components/Tables/WorkspaceSpendRulesTable/index.tsx
Lines 117 to 118 in 94337cb
App/src/components/Tables/WorkspaceCategoryRulesTable/index.tsx
Lines 120 to 121 in 94337cb
App/src/components/Tables/WorkspaceExpenseDefaultsTable/index.tsx
Lines 130 to 131 in 94337cb
In every one of them,
narrowLayoutSortColumnhas the same value asinitialSortColumn. So the prop doesn't change the default order. Its only effect is to lock sorting and hide the eyeball on mobile.What changes do you think we should make in order to solve the problem?
narrowLayoutSortColumnfrom all six tables above. KeepinitialSortColumn, so the default mobile order stays the same (alphabetical by name, destination, card, or condition).narrowLayoutSortColumnbranch inresolveActiveSorting(narrow layout keeps returninguserSorting, as it already does for tables without the prop), theisSortingLockedByLayoutcheck inshouldShowTableDisplaySettingsTrigger, and the prop/context field intypes.ts,TableContext.tsxandTable.tsx. Then no other table can hit this bug again.How this differs from the existing MelvinBot proposal
Melvin's proposal finds the same mechanism but only changes Per diem and Taxes. Distance rates, Spend rules, Category rules and Expense defaults have the same
narrowLayoutSortColumnand would still be missing the eyeball on mobile (the issue says "some mobile tables like Per diem"). This proposal fixes all six and removes the now-unused lock, so the bug can't come back through that prop.What specific scenarios should we cover in automated tests to prevent reoccurrence of this issue?
shouldShowTableDisplaySettingsTrigger: it returns true on a narrow layout whenever the table has at least one sortable column.updateSorting({columnKey: 'rate', order: 'desc'}),activeSortingequals the user's choice, and the initial order isinitialSortColumnascending.What alternative solutions did you explore? (Optional)
Keep the prop but treat it as a default only (use it until the user picks a sort, then respect the user's choice). That works too, but it duplicates
initialSortColumnin every current use, so removing it is simpler.Contributor details
Your Expensify account email: carp-digest@mail.grokbot.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01be5d412b545fdf18
melvin-bot commentedon Nov 18, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Fabtech21 commentedon Nov 18, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On narrow and medium (mobile/tablet) layouts, the Display options (eyeball) trigger is missing from several workspace tables — including Per diem, Taxes, Distance rates, Spend rules (Card restrictions), Category rules, Require fields, and Expense defaults — preventing users from changing the sort column or sort direction on mobile.
What is the root cause of that problem?
There are three coupled issues across
Table,WorkspaceTaxesTable, andsorting.ts(which is why simply deletingnarrowLayoutSortColumnalone introduces a sort/UI desynchronization on Taxes and on conditional columns in narrow layouts):narrowLayoutSortColumnlocks sorting and hides the eyeball across 6 table components (7 workspace screens):WorkspacePerDiemTable(index.tsx:156),WorkspaceTaxesTable(index.tsx:164),WorkspaceDistanceRatesTable(index.tsx:215),WorkspaceSpendRulesTable(index.tsx:118),WorkspaceCategoryRulesTable(index.tsx:121, which also powersWorkspaceRequireFieldsTable), andWorkspaceExpenseDefaultsTable(index.tsx:131) all passnarrowLayoutSortColumnwith the exact same column asinitialSortColumn.When
shouldUseNarrowTableLayout(shouldUseNarrowLayout || isMediumScreenWidth) istrue:shouldShowTableDisplaySettingsTrigger(src/components/Table/TableFilterBar/TableDisplaySettingsTrigger.tsx:32-37andTableFilterBar/index.tsx:34) setsisSortingLockedByLayout = shouldUseNarrowTableLayout && !!narrowLayoutSortColumnand hides the eyeball button.resolveActiveSorting(src/components/Table/middlewares/sorting.ts:106-111) overridesuserSortingwith{columnKey: narrowLayoutSortColumn, order: CONST.SEARCH.SORT_ORDER.ASC}.WorkspaceTaxesTablestripstaxCodefromtaxTableColumnson narrow layouts (src/components/Tables/WorkspaceTaxesTable/index.tsx:59-60, 86):Unlike
WorkspaceCategoriesTable(index.tsx:76-92),WorkspaceTagsTable(index.tsx:100-118),WorkspaceMembersTable(index.tsx:138-184), andWorkspaceDistanceRatesTable(index.tsx:86-99) — which all keep their conditional sortable columns incolumnswhenever the workspace has data for them while hiding the visual cell inside the*TableRowcomponent —WorkspaceTaxesTable/index.tsx:60,86gatestaxTableColumnsonshouldShowTaxCodeCell(!shouldUseNarrowTableLayout && shouldShowTaxCodeColumn) instead ofshouldShowTaxCodeColumn.TableHeader.tsx:192(!shouldUseNarrowTableLayout),TableRow.tsx:227(!shouldUseNarrowTableLayoutCSS grid),useDynamicColumnWidths(Table.tsx:281), andshouldUseTableSemantics(tableAccessibility.ts:150-152,aria-colcount) are all already disabled, andWorkspaceTaxesTableRow.tsx:66independently computes its ownshouldShowTaxCodeCellfor the card layout andaccessibilityLabel.narrowLayoutSortColumnis removed without changingWorkspaceTaxesTable/index.tsx:86toshouldShowTaxCodeColumn, sorting Taxes by Tax code (Descending) on wide layout and resizing to narrow keepsactiveSorting = {columnKey: 'taxCode', order: 'desc'}whileTableDisplaySettingsPopoverComponent.tsx:95(sortableColumns.find(...) ?? sortableColumns.at(0)) falls back toName • Descending— displaying a false sort label in the eyeball menu while rows remain ordered bytaxCode, and preventing mobile users from sorting byTax code.Narrow-layout bypass in
resolveActiveSorting(sorting.ts:106-117) & cleared-column fallback inTableDisplaySettingsPopoverComponent.tsx:95:WorkspaceTaxesTableusesshouldShowTaxCodeColumn(matching every other workspace table;WorkspaceTagsTableonly gatestagCountwhich hassortable: false), no table drops sortable columns solely for narrow layout. Keepingif (shouldUseNarrowTableLayout) { return userSorting; }inresolveActiveSorting(sorting.ts:106-110) skips the missing-column fallback at lines114-116(if (userSorting.columnKey && !columnKeys.includes(userSorting.columnKey))), leaving narrow tables sorted by a deleted conditional column (e.g. after removing the last date-bounded rate inDistance rates) instead of resetting to{columnKey: initialSortColumn, order: initialSortOrder}.TableDisplaySettingsPopoverComponent.tsx:95, resolvingactiveColumnviaactiveSorting.columnKey ?? defaultSorting.columnKeyalignssortByTitlewithopenSortBy()(line 114) whenactiveSorting.columnKeyisundefined(after resetting a header on wide layout) on tables whoseinitialSortColumn(name,card,condition) is notsortableColumns.at(0)(status,type).What changes do you think we should make in order to solve the problem?
narrowLayoutSortColumnfrom the 6 workspace tables and the sharedTableAPI:narrowLayoutSortColumnfromWorkspacePerDiemTable,WorkspaceTaxesTable,WorkspaceDistanceRatesTable,WorkspaceSpendRulesTable,WorkspaceCategoryRulesTable(also fixingWorkspaceRequireFieldsTable), andWorkspaceExpenseDefaultsTable, preservinginitialSortColumn.narrowLayoutSortColumnandisSortingLockedByLayoutfromsrc/components/Table/types.ts,TableContext.tsx,Table.tsx,TableDisplaySettingsTrigger.tsx,TableFilterBar/index.tsx, andmiddlewares/sorting.ts.taxCodesortable on narrow layouts inWorkspaceTaxesTable(src/components/Tables/WorkspaceTaxesTable/index.tsx:59-60, 86):taxCodeentry intaxTableColumnsonshouldShowTaxCodeColumn(matchingWorkspaceCategoriesTable), leavingWorkspaceTaxesTableRow.tsx:66(shouldShowTaxCodeCell) untouched so narrow card layout and VoiceOver/TalkBack labels remain unchanged.resolveActiveSortingandTableDisplaySettingsPopoverComponentfallback:src/components/Table/middlewares/sorting.ts, remove theif (shouldUseNarrowTableLayout)early return inresolveActiveSortingso conditional columns removed fromcolumnKeyscleanly fall back to{columnKey: initialSortColumn, order: initialSortOrder}on all screen widths.src/components/Table/TableFilterBar/TableDisplaySettingsPopoverComponent.tsx:95, matchactiveColumnagainstactiveSorting.columnKey ?? defaultSorting.columnKeybefore falling back tosortableColumns.at(0).tests/unit/components/Table/useSortingTest.tsandtests/ui/TableTest.tsxto cover: (a) eyeball visibility and interactive sorting (Sort by+Sort order+Reset) on narrow/medium layouts, (b)WorkspaceTaxesTablewide-to-narrow resize while sorted bytaxCodepreserving both row order andTax codelabel without rendering ataxCodecell on narrow cards, and (c) narrow-layout fallback toinitialSortColumnwhen a conditional column disappears fromcolumnKeys.What alternative solutions did you explore? (Optional)
narrowLayoutSortColumnwithout updatingWorkspaceTaxesTable(taxTableColumns) andresolveActiveSorting: Exposes the eyeball icon, but leaves Taxes unable to sort byTax codeon mobile, causesTableDisplaySettingsPopoverComponentto misreportNamewhen resizing from a desktopTax codesort, and leaves narrow tables stuck on stale conditional sort keys when the underlying data loses that column.Krishna2323 commentedon Nov 19, 2026
@MelvinBot The root cause looks right, but please research this further and update the proposal to cover the following:
Scope:
narrowLayoutSortColumnis set to the same value asinitialSortColumnin four additional tables:WorkspaceDistanceRatesTable,WorkspaceSpendRulesTable,WorkspaceCategoryRulesTable(also used by Require fields), andWorkspaceExpenseDefaultsTable. The sort option is missing on narrow and medium layouts in these tables too. Please check each one and clarify whether it should be included in the fix. If any should remain locked, explain why.Why the lock was added: Use
git log -S narrowLayoutSortColumn, the PRs that introduced it in each table, andcontributingGuides/TABLE.mdto investigate why each table was locked. Determine whether those reasons still apply now that the Display options trigger renders for every table. For reference, Allow sorting the Expensify Card table on narrow layouts #103897 (issue [Due for payment 2026-10-22] [$175] Expensify card - Sorting/display options are missing on Expensify card page #103578) removed the same lock fromWorkspaceExpensifyCardsTableafter we agreed that sorting should be allowed there.Taxes regression after unlocking:
WorkspaceTaxesTableincludes thetaxCodecolumn only when!shouldUseNarrowTableLayout && shouldShowTaxCodeColumn. On narrow layouts,resolveActiveSortinginsrc/components/Table/middlewares/sorting.tsreturnsuserSortingwithout falling back to another column.This means that if a user sorts by Tax code (descending) on a wide layout and then resizes or rotates a tablet to a narrow layout, the rows remain sorted by Tax code, while the Display options popover shows "Name • Descending" (because
TableDisplaySettingsPopoverComponentfalls back tosortableColumns.at(0)).The current lock hides this inconsistency, but removing it exposes the issue. Please confirm this behavior and propose a fix. Also check whether any other affected table removes a sortable column on narrow layouts.
Shared code: If no table uses
narrowLayoutSortColumnafter this change, please determine whether we should remove the prop, the context field, theisSortingLockedByLayoutcheck, the corresponding branch inresolveActiveSorting, and the documentation inTABLE.md. List every file that would need to change. Also explain whether removing this logic would affect tables that don't currently use the lock.Tests: List all unit tests that should be added or updated, including
shouldShowTableDisplaySettingsTrigger, the sorting middleware tests, and the Taxes resize case.MelvinBot commentedon Nov 19, 2026
Proposal
What is the root cause of that problem?
narrowLayoutSortColumndeliberately forces ascending sorting and hides Display options on narrow and medium layouts. All six remaining consumers set it to theirinitialSortColumn.Removing only the visibility check would expose a control whose selections the sorting middleware ignores. Removing only the table props would unlock sorting, but expose the Taxes resize inconsistency you identified.
Verification: Confirmed through code and introducing PR history; not reproduced in a browser, and no tests were executed.
What changes do you think we should make in order to solve the problem?
1. Include all six tables
Remove their locks while retaining
initialSortColumn:destinationnamenamecardconditionconditionI found no technical requirement to keep any of these locked. Spend rules’ default-rule placement and Expense defaults’ section ordering are enforced independently by their comparators, so user sorting does not remove those safeguards.
Retaining
initialSortColumnpreserves the initial order. Resize behavior intentionally changes: a user’s selected wide-layout sort remains active instead of temporarily switching to the forced narrow-layout sort.Why the locks were introduced—and whether those reasons still apply
I used
git log -S narrowLayoutSortColumn, the introducing PRs and their reviews, and the table guide.For the latter five tables, preserving the existing compact-list order is an inference, not a documented product decision.
The later Add bulk actions for company cards change introduced automatic Display controls but intentionally excluded locked narrow tables. The table guide:45 documents that exception: hiding the control avoids offering ineffective sorting.
The new control addresses the practical need for users to inspect/change their compact-layout sort; it does not automatically rescind the original restriction. Unlocking all six should therefore be an explicit scope decision.
The precedent is Allow sorting the Expensify Card table on narrow layouts, following the agreement to allow Cards sorting. That agreement covered Cards, not advance approval for these six.
Independent safeguards and inherited scope:
2. Fix Taxes by retaining its logical Tax code column
Your resize analysis is correct after unlocking:
taxCode/ descending.taxCodefrom the columns.For example, rows
Alpha/Z,Bravo/A,Charlie/Mremain ordered Alpha, Charlie, Bravo, despite the menu saying Name • Descending.Recommended fix: Include
taxCodein the logical column definitions whenevershouldShowTaxCodeColumnis true, regardless of layout. Remove the parent’s now-unused layout-dependent cell condition. Keep the row component’s existing narrow-layout visual and accessibility hiding unchanged.That preserves the selected sort, keeps Tax code available in Display options, and does not add a Tax code cell to narrow cards.
Of the six affected tables, only Taxes drops a sortable column because of layout. Distance rates has conditional tax/date columns, but those depend on workspace data/settings, not width; the other four have layout-independent column definitions.
Taxes evidence
3. Remove the obsolete lock API—but preserve the separate narrow-layout fallback policy
After removing these six assignments, no production consumer remains. Remove the prop, context field, middleware argument, forced-sort expression, visibility restriction, and documentation.
Important distinction: Do not silently delete the entire narrow-layout early return from
resolveActiveSorting. Without a lock, that branch already preservesuserSortingwhen its column is absent. Applying the wide-layout missing-column fallback everywhere would change existing unlocked tables too.For example, Members drops sortable columns through layout-dependent parent props:453–465. Removing the bypass would change its compact-layout ordering.
Therefore:
return userSorting, and fix Taxes’ logical columns.Complete production/documentation file list: 13 files
Remove the assignments in:
Remove shared plumbing/documentation in:
7. Table/types.ts:255–256
8. Table/Table.tsx:176 — destructuring, middleware argument, and context value.
9. Table/TableContext.tsx:113–114 — field and default.
10. Table/middlewares/sorting.ts:68–145
11. TableDisplaySettingsTrigger.tsx:21–56
12. TableFilterBar/index.tsx:31–35
13. contributingGuides/TABLE.md:45
No wrapper, row-component, or popover change is required for this approach. Keep layout-dependent compact-button rendering and empty-table toolbar behavior.
4. Automated tests
shouldShowTableDisplaySettingsTriggerTest.tsbeside the existing Table unit testsWorkspaceTaxesTableTest.tsxbeside TableTest.tsxshouldShowTaxCodeColumn=false, it is absent from options at every width.What alternative solutions did you explore? (Optional)
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/107274)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
Krishna2323 commentedon Nov 19, 2026
@MelvinBot implement this
MelvinBot commentedon Nov 19, 2026
⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.
Run details
Krishna2323 commentedon Nov 19, 2026
@MelvinBot implement this
MelvinBot commentedon Nov 19, 2026
🤖 Web test steps verification results: ❌ fail
Browser verification was blocked by a blank app page and unavailable session; this is not a confirmed product regression.
Verify compact Display options, Taxes resize sorting, and sorting/reset across affected tables
The app rendered no inspectable content, so browser behavior could not be verified.Implemented and committed locally as
e5bfd8b13b:Checks: 248 targeted tests passed, along with lint, typecheck, formatting, and Storybook smoke tests. Code review found no actionable issues. The full test suite exceeded five minutes without completing.
No branch was pushed and no PR was created. The run reached its step limit after a shallow-history problem prevented finding the merge base; fetching more history timed out.
Remaining: restore sufficient Git history, verify the final diff, push the commit, and create the draft PR assigned to
Krishna2323. Browser verification also remains blocked.view run · no recording available
Krishna2323 commentedon Nov 20, 2026
@MelvinBot implement this and open a draft PR assigned to me.
To stay within the run limit:
tests/unit/components/Table/useSortingTest.ts,tests/ui/TableTest.tsx, and the new Taxes and trigger tests), plus lint and typecheck on changed files. Don't run the full suite.origin/mainand don't compute a merge base or fetch full history. If you need a diff, compare againstorigin/maindirectly.MelvinBot commentedon Nov 20, 2026
Created draft PR Allow sorting workspace tables on compact layouts, assigned to
Krishna2323.view run