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
[Due for payment 2025-04-14] [$250] Workflows - Approver remains highlighted when navigating the list with keyboard #57606
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.1.7-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: Exp Email or phone of affected tester (no customers):applausetester+sj9032@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Mac 15.3 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Workspace has a few members.
Workflows are enabled.
Go to staging.new.expensify.com
Go to workspace settings > Workflows.
Click Submission frequency.
Click Monthly > Date of month.
Use down arrow to navigate the list.
Note that the selected option is not highlighted and there is only one highlighted row.
Close the RHP.
Click on the existing workflow.
Click Approver.
Use down arrow to navigate the list.
Expected Result:
The selected user is not highlighted and there is only one highlighted row.
Actual Result:
The selected user remains highlighted and there are two highlighted rows.
🚨 Edited by proposal-police: This proposal was edited at 2025-02-28 11:08:28 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workflows - Approver remains highlighted when navigating the list with keyboard
What is the root cause of that problem?
On WorkspaceWorkflowsApprovalsApproverPage we set shouldHighlightSelectedItem as true, which causes multiple rows to remain highlighted when navigating via the keyboard.
📣 @ryntgh! 📣
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:
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.
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.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
sections={sections}ListItem={InviteMemberListItem}textInputLabel={shouldShowListEmptyContent ? undefined : translate('selectionList.findMember')}textInputValue={searchTerm}onChangeText={setSearchTerm}headerMessage={headerMessage}onSelectRow={toggleApprover}showScrollIndicatorshouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()}footerContent={button}listEmptyContent={listEmptyContent}shouldShowListEmptyContent={shouldShowListEmptyContent}// shouldHighlightSelectedItem //removeshouldShowTextInput={shouldShowTextInput}initiallyFocusedOptionKey={selectedApproverEmail}// allow update selected item via keyboardshouldUpdateFocusedIndex// allow update selected item via keyboard/>
Finally, remove the condition inside toggleApprover because it is called twice times by the 'Enter' key and once by the onPress event—leading to setSelectedApproverEmail being set to undefined when 'Enter' is pressed.
Optional: We can prevent toggleApprover from being called twice by adding shouldPreventEnterKeySubmit to InviteMemberListItem and only apply for this approver flow.
Note: We can apply Optional above if we allow an unselected item, but I noticed that we do not allow setting the approver to undefined, so we can remove the condition inside toggleApprover, and it should be fine
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A, Keyboard issue
What alternative solutions did you explore? (Optional)
shouldHighlightSelectedItem was added in #50541. At that time, this prop was added to highlight the selected option.
What changes do you think we should make in order to solve the problem?
We need to remove shouldHighlightSelectedItem completely in all places in the codebase (This is an important step to prevent using this prop in the future)
And then introduce a new way to solve this bug. Let's add these props
For enter key problem, we can wrap toggleApprover by debounce function
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
It is necessary to add more unit tests in tests/unit/BaseSelectionListTest.tsx These tests would ensure keyboard navigation continues to work as intended and catch potential regressions early in the development cycle (avoid unexpected change as introducing shouldHighlightSelectedItem in #50541). I suggest adding these tests:
should initially focus the specified item by initiallyFocusedOptionKey
should update focus when shouldUpdateFocusedIndex is true and item is selected
should not update focus when shouldUpdateFocusedIndex is false
should handle keyboard navigation and update focus accordingly
Pseudo Code (just drafted, need to adjust more in the PR phase)
it('should initially focus the specified item by initiallyFocusedOptionKey', () => {
const initialKey = '3';
render(
<BaseListItemRenderer
sections={[{data: mockSections}]}
initiallyFocusedOptionKey={initialKey}
/>,
);
// The item with key '3' should be focused
const focusedItem = screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}3`);
expect(focusedItem).toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
});
it('should update focus when shouldUpdateFocusedIndex is true and item is selected', () => {
render(
<BaseListItemRenderer
sections={[{data: mockSections}]}
initiallyFocusedOptionKey="1"
shouldUpdateFocusedIndex
/>,
);
// Initially item 1 is focused
expect(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}1`))
.toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
// Select item 3
fireEvent.press(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}3`));
// Item 3 should now be focused
expect(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}3`))
.toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
// Verify onArrowFocus was called with the correct item
expect(onArrowFocusMock).toHaveBeenCalledWith(expect.objectContaining({
keyForList: '3'
}));
});
it('should not update focus when shouldUpdateFocusedIndex is false', () => {
render(
<BaseListItemRenderer
sections={[{data: mockSections}]}
initiallyFocusedOptionKey="1"
shouldUpdateFocusedIndex={false}
/>,
);
// Initially item 1 is focused
expect(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}1`))
.toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
// Select item 3
fireEvent.press(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}3`));
// Item 1 should still be focused
expect(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}1`))
.toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
// Verify onArrowFocus was not called
expect(onArrowFocusMock).not.toHaveBeenCalled();
});
it('should handle keyboard navigation and update focus accordingly', () => {
render(
<BaseListItemRenderer
sections={[{data: mockSections}]}
initiallyFocusedOptionKey="1"
shouldUpdateFocusedIndex
/>,
);
// Simulate pressing arrow down key
fireEvent.keyDown(screen.getByTestId('selection-list'), { key: 'ArrowDown' });
// Next item should be focused
expect(screen.getByTestId(`${CONST.BASE_LIST_ITEM_TEST_ID}2`))
.toHaveProp('accessibilityState', expect.objectContaining({ focused: true }));
// Verify onArrowFocus was called with the correct item
expect(onArrowFocusMock).toHaveBeenCalledWith(expect.objectContaining({
keyForList: '2'
}));
});
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-]Workflows - Approver remains highlighted when navigating the list with keyboard[/-][+][$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/+]on Mar 3, 2025
changed the title [-][$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/-][+][Due for payment 2025-04-14] [$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/+]on Apr 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@dominictb@zanyrenney@dominictb The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Workspace has a few members
Workflows are enabled
Test:
Go to workspace settings > Workflows.
Click on the existing workflow.
Click Approver.
Use down arrow to navigate the list
Verify selected user is not highlighted and the highlighted background moves along with the currently focused user
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Feb 28, 2025
Triggered auto assignment to @zanyrenney (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.ryntgh commentedon Feb 28, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-02-28 11:08:28 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workflows - Approver remains highlighted when navigating the list with keyboard
What is the root cause of that problem?
On
WorkspaceWorkflowsApprovalsApproverPagewe setshouldHighlightSelectedItemas true, which causes multiple rows to remain highlighted when navigating via the keyboard.App/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Line 280 in 5a8a260
What changes do you think we should make in order to solve the problem?
We should adjust the
SelectionListso that only one row is highlighted at any time.shouldHighlightSelectedItemprop.initiallyFocusedOptionKey={selectedApproverEmail}like we did here.key={selectedApproverEmail}so that it re-mounts whenever the selected approver changes.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
New-Expensify.mp4
melvin-bot commentedon Feb 28, 2025
📣 @ryntgh! 📣
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:
Format:
melvin-bot commentedon Feb 28, 2025
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
linhvovan29546 commentedon Feb 28, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workflows - Approver remains highlighted when navigating the list with keyboard
What is the root cause of that problem?
In the
WorkspaceWorkflowsApprovalsApproverPagewe haveshouldHighlightSelectedItemprops, so the selected item is always highlightedApp/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Line 280 in 5a8a260
And we are missing
initiallyFocusedOptionKey, causing the focus when pressing 'Tab' to always default to the first item(index 0).What changes do you think we should make in order to solve the problem?
App/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Line 267 in 5a8a260
Finally, remove the condition inside
toggleApproverbecause it is called twice times by the 'Enter' key and once by the onPress event—leading tosetSelectedApproverEmailbeing set to undefined when 'Enter' is pressed.App/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Lines 222 to 228 in 5a8a260
Optional: We can prevent
toggleApproverfrom being called twice by addingshouldPreventEnterKeySubmitto InviteMemberListItem and only apply for this approver flow.Note: We can apply Optional above if we allow an unselected item, but I noticed that we do not allow setting the approver to
undefined, so we can remove the condition insidetoggleApprover, and it should be fineWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A, Keyboard issue
What alternative solutions did you explore? (Optional)
N/A
thelullabyy commentedon Feb 28, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-17 09:18:42 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The selected user remains highlighted and there are two highlighted rows.
What is the root cause of that problem?
In the approver page, we set shouldHighlightSelectedItem to SelectionList. So the selected option will always be highlighted
App/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Line 280 in 5a8a260
shouldHighlightSelectedItemwas added in #50541. At that time, this prop was added to highlight the selected option.What changes do you think we should make in order to solve the problem?
We need to remove
shouldHighlightSelectedItemcompletely in all places in the codebase (This is an important step to prevent using this prop in the future)And then introduce a new way to solve this bug. Let's add these props
App/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx
Line 267 in 5a8a260
For enter key problem, we can wrap toggleApprover by debounce function
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
It is necessary to add more unit tests in tests/unit/BaseSelectionListTest.tsx These tests would ensure keyboard navigation continues to work as intended and catch potential regressions early in the development cycle (avoid unexpected change as introducing shouldHighlightSelectedItem in #50541). I suggest adding these tests:
Pseudo Code (just drafted, need to adjust more in the PR phase)
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[-]Workflows - Approver remains highlighted when navigating the list with keyboard[/-][+][$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/+]melvin-bot commentedon Mar 3, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021896618864180272606
38 remaining items
[-][$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/-][+][Due for payment 2025-04-14] [$250] Workflows - Approver remains highlighted when navigating the list with keyboard[/+]melvin-bot commentedon Apr 7, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Apr 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-04-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Apr 7, 2025
@dominictb @zanyrenney @dominictb The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
dominictb commentedon Apr 8, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/50541/files#r2033071522
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
zanyrenney commentedon Apr 14, 2025
https://github.com/Expensify/Expensify/issues/490719
zanyrenney commentedon Apr 15, 2025
payment summary
@dominictb requires payment automatic offer (Contributor) $250 paid via upwork.
@thelullabyy requires payment automatic offer (Contributor) $250 paid via upwork.