-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$500] IOU - The selected category moves to the top of the list when <8 categories active #36912
Comments
Job added to Upwork: https://www.upwork.com/jobs/~014ddec0e527151c87 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
|
Triggered auto assignment to @tgolen ( |
We think that this bug might be related to #wave6-collect-submitters |
@lukemorawski It appears this could be related to your PR #35567. Can you confirm? I'm going to demote this issue from being a deploy blocker to being a normal bug. cc @cristipaval |
Can't seem to reproduce it on latest master. |
@tgolen I can confirm that this is still reproducible on latest |
ProposalPlease re-state the problem that we are trying to solve in this issue.When category list has less than 8 items and you select a category, the selected category will move to the top of the list What is the root cause of that problem?It's a regression from #35922 const enabledAndSelectedCategories = [...selectedOptions, ...sortedCategories.filter((category) => category.enabled && !selectedOptionNames.includes(category.name))]; This will always move the selected options to the top of the list regardless of the site of the list. What changes do you think we should make in order to solve the problem?To solve this issue we need to go back to what we had before but we need to make sure to enable any disbaled categories so that they can be de-selected. To do that I propose we iterate through each selected option, find it's index in the ALSO, and this is important, if we cannot find a match, we With the original code any deleted category would not be on the list (but it would if more than 8 categories are present). Here's the proposed code change: const enabledAndSelectedCategories = sortedCategories.filter((category) => category.enabled || selectedOptionNames.includes(category.name));
selectedOptions.forEach((selectedOption) => {
const enabledAndSelectedCategoriesIndex = enabledAndSelectedCategories.findIndex((category) => category.name === selectedOption.name);
if (enabledAndSelectedCategoriesIndex === -1) {
enabledAndSelectedCategories.unshift(selectedOption);
} else {
enabledAndSelectedCategories.splice(enabledAndSelectedCategoriesIndex, 1, selectedOption);
}
}); This could be extracted into a helper method for better readability. What alternative solutions did you explore? (Optional)Another options is to leave the code the way it currently is but then call 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. |
This should be handled by folks involved in offending PR |
@tienifr I'm going to assign to you for now. |
@tienifr would you mind commenting on this issue so I can then assign it to you? |
@tgolen This is intentional in here
I think we need to confirm the expectations first. @Expensify/design Could you guys check this issue and verify if we should fix it? Note that: In many other places, the selected option is in the first position on the list cc @tienifr |
In my mind the category list shouldn't reorder based on selection but keen to hear what @dannymcclain and @shawnborton thinks. I don't feel too strongly though |
Hmm I could be wrong here, but I think if the list options are less than say 9, we never reoder the list even after one is selected. But if the list is super long, the current selected list item moves to the top and we get a UI that looks like this: cc @trjExpensify - thoughts on that? |
@shawnborton @dubielzyk-expensify IMO we should have consistent behavior in both cases, otherwise the user might be confused when seeing the selected item jumps around when enabling/disabling categories. I don't see any downside with having the selected item on top consistently in both cases. |
We already discussed expected behavior in #34018 |
This was how I thought it worked as well. But seeing this issue pop up made me question why we have a bunch of conditional logic (ie - added complexity) for lists at all. I mean you know me, I'm a set it and forget it kinda guy! 😂
Now I think I'm trending toward agreeing with this perspective. |
Oh @aimane-chnaif thanks for posting that. Everyone feel free to ignore me and just do what the team has already decided on. |
Yep, agreed. With 8 or less there's no "recent" section or search input and therefore the selected category doesn't sit above that section in the list - it remains in place. For comparison with what you posted above: |
@Julesssss While implementing PR to fix this issue, we faced a new bug as mentioned here. It is caused by the position of the selected option change when we increase the number of categories from 7 to 8. |
Currently, I see 2 options:
|
Choosing behavior to avoid bugs isn't a good reason. but I'm also a bit unsure where we aligned based on the above comments. @Expensify/design & @trjExpensify, did we align on this? |
The behaviour came from the categories doc in wave6. Latest ref here. |
Thanks. So keeping the option in place aligns with 2 here:
|
Yes, I am reviewing this PR |
FWIW I like always displaying the selected option at the first of the list (option 1).
I feel that having the UX change based on the number of items in the list just feels like we are getting more clever than we need to. Let's go with the most simple solution first, and if we get significant customer feedback that this isn't ideal, we can change it later. |
Personally I tend to agree with Tim. But I think this behavior is something that has been talked about widely and decided upon by the larger team. I'm hesitant to let my opinion override a widely agreed upon and documented behavior. 🤷♂️ |
I don't feel too strongly. I think the idea behind not changing the order on the smaller amounts of list items (less than 9) was that you can see all of the items in your viewport, and thus it might feel weird if you have the list jumping when you can see the entire screen at once? That being said, definitely down to go with consistency here. |
@tgolen @Julesssss What is the final confirmation? |
Alright, thanks everyone. So we all agree on the consistent component behaviour for now... which is this option:
@DylanDylann you may want hold for a few hours just in case of any final objections |
@Julesssss If there aren't any objections, let's close this issue. @tienifr Also close this PR |
Closing based on this comment |
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.43-0
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4327825
Issue reported by: Applause - Internal Team
Action Performed:
Preconditions:
In OldDot under admin, create a Collect group policy, enable categories and add 3 categories, add an employee to the policy. Setup OldDot Collect Policy:
https://sites.google.com/applausemail.com/applause-expensifyproject/wiki-guides/newdot-categories?authuser=0
Expected Result:
The selected category should remain in its place in alphabetical order if <8 categories are active
Actual Result:
The selected category moves to the top of the list when <8 categories active
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6385731_1708436028448.Recording__1359.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: