-
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
[HOLD for payment 2023-01-19] [$1000] Chat - New Group - The search box overlays the selected user #14001
Comments
Triggered auto assignment to @NicMendonca ( |
Bug0 Triage ChecklistNote: see this SO for more information.
|
Job added to Upwork: https://www.upwork.com/jobs/~012de37194a5fa31d2 |
Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr ( |
Triggered auto assignment to @flodnv ( |
I believe this issue is related to auto scrolling of the option list as per the comment here we are looking to redesign the UI/UX of options list it should be resolved with we can put it on hold till then i guess. |
ProposalThe issue is being caused by scrolling to the first FixFollowing needs to be changed: diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js
index 8e2668be2..671968e16 100755
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -110,14 +110,7 @@ class BaseOptionsSelector extends Component {
// If we just toggled an option on a multi-selection page, scroll to top
if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
this.scrollToIndex(0);
- return;
}
-
- // Otherwise, scroll to the focused index (as long as it's in range)
- if (this.state.allOptions.length <= this.state.focusedIndex) {
- return;
- }
- this.scrollToIndex(this.state.focusedIndex);
});
}
ResultScreen.Recording.2023-01-06.at.1.49.51.AM.mov |
Proposal When the textInput is cleared we scroll to the focused index, if we want to scroll to the top when we clear the textbox we can change this line: App/src/components/OptionsSelector/BaseOptionsSelector.js Lines 110 to 114 in c2c7e70
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
+ if (this.props.selectedOptions.length !== prevProps.selectedOptions.length || this.props.value === '') { |
Thank you guys for the proposal! @NicMendonca as per comment here, do we want to hold this for the redesign? cc @mountiny |
ProposalProblemWe are scrolling to the focused index and the focused index is assigned with Solution 1We shouldn't scroll to the focused index and whenever componentDidUpdate(prevProps) {
if (_.isEqual(this.props.sections, prevProps.sections)) {
return;
}
const newOptions = this.flattenSections();
const newFocusedIndex = this.props.selectedOptions.length;
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
// If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
- this.scrollToIndex(0);
- return;
- }
- Otherwise, scroll to the focused index (as long as it's in range)
- if (this.state.allOptions.length <= this.state.focusedIndex) {
- return;
- }
- this.scrollToIndex(this.state.focusedIndex);
+ if (
+ this.props.selectedOptions.length !== prevProps.selectedOptions.length
+ || _.isEqual(this.props.sections[1].data, prevProps.sections[1].data)
+ || _.isEqual(this.props.sections[2].data, prevProps.sections[2].data)) {
+ this.scrollToIndex(0);
+ }
+ });
} Solution 2We shouldn't scroll to the focused index and whenever componentDidUpdate(prevProps) {
if (_.isEqual(this.props.sections, prevProps.sections)) {
return;
}
const newOptions = this.flattenSections();
const newFocusedIndex = this.props.selectedOptions.length;
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
// If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
+ if (this.props.selectedOptions.length !== prevProps.selectedOptions.length || this.props.value !== prevProps.value) {
this.scrollToIndex(0);
return;
}
- Otherwise, scroll to the focused index (as long as it's in range)
- if (this.state.allOptions.length <= this.state.focusedIndex) {
- return;
- }
- this.scrollToIndex(this.state.focusedIndex);
} ResultScreen.Recording.2023-01-06.at.11.10.47.mp4 |
@flodnv @NicMendonca @mollfpr Hmm, I would actually argue this is not a bug, I think think that once you are ready to search for more people it is fine we are showing the recent chats. We allow up to 8 people to be selected for a group chat, so then you would only see the selected people when you want to select more, maybe from the recents field, which does not seem ideal UX. I would say this is not a bug, maybe we should open a discussion in #expensify-open-source to align on this and create a regression test accordingly. Or indeed fix this but endure that it works as we want. |
Agreed, discussing here: https://expensify.slack.com/archives/C049HHMV9SM/p1672996492671499 |
Proposal For eg, Assume we have a list of 10 people, assuming view can only show 5 rows(different screen sizes can show higher or lower count). We have already selected 5 rows and we clear the search, now we scroll to index 0 as per requirement but set the highlighted row to be 6th row which would be hidden as per below code. Even if you press 'enter' now it only select the 6th row which is hidden from view. App/src/components/OptionsSelector/BaseOptionsSelector.js Lines 103 to 115 in b081ed1
This is weird IMO as we are highlighting a different row but scrolling to a different row, if we just scroll to index 0 to solve this issue I have also posted a separate bug in the bug channel now to report the current bug. As we set the highlighted row to be different, there is always a possibility the highlighted row will be hidden when we scroll to 0 row which will also happen if we just fix clear text issue - https://expensify.slack.com/archives/C049HHMV9SM/p1673109991457219. So I am proposing below solutions to solve this clear text issue without causing a new highlight issue bug. Current behaviour:
Highlight = first row in unselected section, scrollTo = 0
Highlight = first row in unselected section, scrollTo = 0
Highlight = first row in unselected section, scrollTo = No scroll
Highlight = first row in unselected section, scrollTo = first row in unselected section
Default Proposed Behaviour 1 (Best IMO):
Highlight = last selected row, scrollTo = last selected row
Highlight = 0, scrollTo = 0
Highlight = first row in unselected section, scrollTo = first row in unselected section
Highlight = 0, scrollTo = 0
Default --- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -96,23 +96,22 @@ class BaseOptionsSelector extends Component {
}
componentDidUpdate(prevProps) {
- if (_.isEqual(this.props.sections, prevProps.sections)) {
+ if (_.isEqual(this.props.sections, prevProps.sections) && _.isEqual(this.props.value, prevProps.value)) {
return;
}
const newOptions = this.flattenSections();
- const newFocusedIndex = this.props.selectedOptions.length;
+ let newFocusedIndex = this.props.selectedOptions.length;
+ if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
+ newFocusedIndex = prevProps.selectedOptions.length > this.props.selectedOptions.length ? 0 : this.props.selectedOptions.length - 1
+ } else if (_.isEmpty(this.props.value) && (this.props.value !== prevProps.value)) {
+ newFocusedIndex = 0;
+ }
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
- // If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
- this.scrollToIndex(0);
- return;
- }
-
// Otherwise, scroll to the focused index (as long as it's in range)
if (this.state.allOptions.length <= this.state.focusedIndex) {
return; Proposal.1.mp4Proposal behaviour 2:
Highlight = 0, scrollTo = 0
Highlight = 0, scrollTo = 0
Highlight = first row in unselected section, scrollTo = first row in unselected section
Highlight = 0, scrollTo = 0
Default Code diff --- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -96,23 +96,21 @@ class BaseOptionsSelector extends Component {
}
componentDidUpdate(prevProps) {
- if (_.isEqual(this.props.sections, prevProps.sections)) {
+ if (_.isEqual(this.props.sections, prevProps.sections) && _.isEqual(this.props.value, prevProps.value)) {
return;
}
const newOptions = this.flattenSections();
- const newFocusedIndex = this.props.selectedOptions.length;
+ let newFocusedIndex = this.props.selectedOptions.length;
+ if (this.props.selectedOptions.length !== prevProps.selectedOptions.length
+ || (_.isEmpty(this.props.value) && (this.props.value !== prevProps.value))) {
+ newFocusedIndex = 0;
+ }
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
- // If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
- this.scrollToIndex(0);
- return;
- }
-
// Otherwise, scroll to the focused index (as long as it's in range)
if (this.state.allOptions.length <= this.state.focusedIndex) {
return; Proposal.2.mp4Proposal behaviour 3:
Highlight = first row in unselected section, scrollTo = first row in unselected section
Highlight = first row in unselected section, scrollTo = first row in unselected section
Highlight = first row in unselected section, scrollTo = first row in unselected section
Highlight = 0, scrollTo = 0
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -96,23 +96,20 @@ class BaseOptionsSelector extends Component {
}
componentDidUpdate(prevProps) {
- if (_.isEqual(this.props.sections, prevProps.sections)) {
+ if (_.isEqual(this.props.sections, prevProps.sections) && _.isEqual(this.props.value, prevProps.value)) {
return;
}
const newOptions = this.flattenSections();
- const newFocusedIndex = this.props.selectedOptions.length;
+ let newFocusedIndex = this.props.selectedOptions.length;
+ if ((_.isEmpty(this.props.value) && (this.props.value !== prevProps.value))) {
+ newFocusedIndex = 0;
+ }
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
- // If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
- this.scrollToIndex(0);
- return;
- }
-
// Otherwise, scroll to the focused index (as long as it's in range)
if (this.state.allOptions.length <= this.state.focusedIndex) {
return; Proposal.3.mp4I think proposal 1 would have the best behaviour. But, If required we can also mix and match the above 3 to create different behaviour combination. Proposal with just clear text scroll fix Code diff --- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -108,7 +108,8 @@ class BaseOptionsSelector extends Component {
focusedIndex: newFocusedIndex,
}, () => {
// If we just toggled an option on a multi-selection page, scroll to top
- if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) {
+ if (this.props.selectedOptions.length !== prevProps.selectedOptions.length
+ || (_.isEmpty(this.props.value) && (this.props.value !== prevProps.value))) {
this.scrollToIndex(0);
return;
} Proposal.mp4 |
@mollfpr My proposal does the same thing. Have you considered it? |
@mollfpr doesn't just scrolling to top without changing the highlight cause the issue I mentioned here - #14001 (comment) Are we ok with that behaviour? |
@allroundexperts Yes. In your proposal selecting an account and searching for another account by typing in the search box, the scroll position remains the same (on top). I don't think we want that.
Thanks for the detailed @abdulrahuman5196 but what you pointing out is another issue and we don't know yet if that will be an issue. I don't mind after selecting an account the highlight option is the first row unselected option, this will be helpful if navigating through the options with the arrow key to go through the unselected options. |
@mollfpr Are you sure we don't want that behaviour? Because In my opinion, it makes more sense to keep the selected item sticky throughout. |
@allroundexperts For example, if we have 7 selected options already and searching for another account will only give a smaller space visibility to show unselected options, am I correct? If is that so, I think this will be an issue in the future or even regression. |
Ahh sorry for that, I must be misspelling your name before. 😅 |
All yours @mollfpr ! |
@flodnv - can you confirm that Olly is to be paid $1000 + the PR merge bonus of 50% (i.e. $1500?) |
Yes please 👍 |
Will I get the bonus too? 😁 |
Yep 👍 |
@sophiepintoraetz I can't open the link. |
Sorry, try this one! |
@sophiepintoraetz Applied, thank you! |
@sophiepintoraetz I think you should end the Upwork contract after the PR is in production and past the 7 days regression period 😅 Currently, the PR is still in staging but maybe later today or tomorrow will hit production. |
Ah, I am on auto-pilot mode - wow - let's hope a regression doesn't pop up 😅 |
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.52-4 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 2023-01-19. 🎊 After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:
As a reminder, here are the bonuses/penalties that should be applied for any External 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:
|
@sophiepintoraetz @flodnv I don’t there’s a PR causing this regression. As mentioned in the Slack discussion, is more of a polish issue. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
When selecting users, they are displayed on the top of the list with a green check mark on the right.
Actual Result:
The user who has already been selected in the group is hiding behind the search box.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.48.2
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug5885194_Recording__210.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: