-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WAITING ON SITU TO FINISH CHECKLIST] [LOW] [Splits] [$500] IOU - Tapping split button & selecting 2nd contact are not highlighted like 1st contact #35665
Comments
Job added to Upwork: https://www.upwork.com/jobs/~010e869b36a20a1985 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel ( |
Triggered auto assignment to @jliexpensify ( |
We think that this bug might be related to #wave5-free-submitters |
ProposalPlease re-state the problem that we are trying to solve in this issue.Tapping split button & selecting 2nd contact are not highlighted like 1st contact What is the root cause of that problem?We only highlight/ Focus the top index element. App/src/components/SelectionList/BaseSelectionList.tsx Lines 223 to 231 in a0614e9
What changes do you think we should make in order to solve the problem?Update the function to highlight all the selected participants What alternative solutions did you explore? (Optional)N/A Some Thoughts: Anyway, if this feels like a bug would like to solve this |
@GandalfGwaihir regarding your comment:
I think the bug is that when you select a second person, the first person is still highlighted. I agree that the focus should move down the list, but it should then highlight the 2nd person instead, as it's the most recently selected. @kbecciv is this essentially what you are saying? |
I think this should actually go in #vip-split: https://expensify.slack.com/archives/C05RECHFBEW/p1707097628668729 |
cc: @Expensify/design can you confirm whether this issue is bug or not? |
🤔 I do not know. I guess it's not a bug since we keep the first item of a list focused... but why do we keep the first item of a list focused? I think in this situation I would expect none of the list items to have focus. Anyone else?
I guess if we definitely want to maintain focus inside the list (which I would still love to hear why we want to do that—could be something very obvious that I'm not understanding) then I would agree with Jason that the most recent person selected should be the one that gets focus. |
The behavior same in the other places too, I think this is designed this way, maybe @shawnborton help here as he was part of the selection list refactor Screen.Recording.2024-02-07.at.3.00.44.AM.mov |
This is exactly the question I asked myself, and why I assumed it was a bug. Here's my thought:
|
Yeah I guess this is technically not a bug but I do tend to agree with this one:
It seems like maybe we have competing styles for list selection where selected items typically have a different BG color, but your keyboard focus also gets a darker BG color. So I wonder if it makes sense to not have the keyboard focus on any of the list items until you explicitly start using the down arrow/tab button to go down from the input? And then we might consider using an outline style for the focus style as opposed to a BG color? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@shawnborton I think you (and the Design Team) probably have the final say here! What do you recommend the solution should be?
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Tapping split button & selecting 2nd contact are not highlighted like 1st contact What is the root cause of that problem?Initial ProposalThis code always sets the focused index to 0 (firstItem) whenever the sections change. https://github.com/Expensify/App/blob/a0614e9f68f1c066958f481b22559d9bc37e7d99/src/components/SelectionList/BaseSelectionList.tsx#L350-L361 ### What changes do you think we should make in order to solve the problem? Instead of focusing always on the first item, I believe we should be focusing in the first non-selected item like we do with `BaseOptionsSelector`, in that component whenever we select any option the focusedIndex is set to the next item.This is how BaseOptionsSelector works: base_options_selector.mp4Steps to update the code:
const lastTextValue = usePrevious(textInputValue);
const updateAndScrollToFocusedIndex = useCallback(
(newFocusedIndex: number, scrollIndex?: number) => {
setFocusedIndex(newFocusedIndex);
scrollToIndex(scrollIndex ?? newFocusedIndex, true);
},
[scrollToIndex],
);
useEffect(() => {
// do not change focus on the first render, as it should focus on the selected item
if (isInitialSectionListRender) {
return;
}
if (lastTextValue !== textInputValue) {
updateAndScrollToFocusedIndex(0);
return;
}
// set the focus on the first item when the sections list is changed
if (sections.length > 0) {
updateAndScrollToFocusedIndex(flattenedSections.selectedOptions.length, 0);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [sections]);
Resultfix_demo_option_selection.mp4AlternativePrev Alternative~Instead of setting focused index to first non selected item we set focus to -1, so that no item will be focused.~
We should always set the Will discuss more changes with the design team if required. if (sections.length > 0 && previousSelectedLength !== flattenedSections.selectedOptions.length) {
updateAndScrollToFocusedIndex(-1, 0);
return;
} We also need to update
To remove focus and scroll to top we need to follow few steps:
const prevSelectedOptionsLength = usePrevious(flattenedSections.selectedOptions.length);
useEffect(() => {
// Avoid changing focus if the textInputValue remains unchanged.
if ((prevTextInputValue === textInputValue && prevSelectedOptionsLength === flattenedSections.selectedOptions.length) || flattenedSections.allOptions.length === 0) {
return;
}
// Remove the focus if the search input is empty else focus on the first non disabled item
const newSelectedIndex = textInputValue === '' || prevSelectedOptionsLength !== flattenedSections.selectedOptions.length ? -1 : 0;
const newScrollIndex = prevSelectedOptionsLength !== flattenedSections.selectedOptions.length ? 0 : newSelectedIndex;
updateAndScrollToFocusedIndex(newSelectedIndex, newScrollIndex);
}, [
canSelectMultiple,
flattenedSections.allOptions.length,
prevTextInputValue,
textInputValue,
updateAndScrollToFocusedIndex,
prevSelectedOptionsLength,
flattenedSections.selectedOptions.length,
]); Resultfocus_after_selection.mp4 |
Hmm that result video actually feels pretty good to me. But I think I'm still debating between that solution and not focusing any items in the list at all. The main reason I'm not sure we should focus the list at all is because you can't really add someone to a split with your keyboard anyways. If you try to, it seems like what ends up happening is you're just advanced to regular manual request confirmation screen with a single participant (the person who you keyboarded to). So I'm not totally sure what value the focus is providing here. Would love to get @Expensify/design thoughts on each of these approaches. |
Oh that's a really valid point that keyboard controls basically don't really work in the split flow, so I would be down with getting rid of the keyboard focus as soon as you have selected one split. |
Nice, ty everyone! @Santhosh-Sellavel - could I get you to review the updated proposals? Thanks! |
Back - thanks @trjExpensify for the assist. I'll unassign you! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.62-17 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 2024-04-25. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payment Summary
I had to create a new Upworks job, please accept! Also @situchan - please complete the checklist |
@jliexpensify, accepted, thanks! |
Thanks! Bumping @situchan to accept so I can pay everyone at once + complete checklist. |
Bumped @situchan again |
Was hoping to pay both together but seems like @situchan is still on vacation. @Krishna2323 apologies for the delay, have paid you. |
Paid and job closed, waiting on the checklist |
Bump @situchan - does the checklist need to be completed? |
Not able to find offending PR since this component was changed so many times. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.35.0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4263802
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Expected Result:
When user taps split button (no matter first or second selection), the row isn't always highlighted but only green tick is shown
Actual Result:
When user taps split button and select 2nd contact, only green tick shown, it is not highlighted like first contact after selection.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6364658_1706869108259.high.1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @situchanThe text was updated successfully, but these errors were encountered: