Do not select participant in IOU confirmation list#14502
Conversation
|
@parasharrajat @aldo-expensify One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Will be reviewing shortly. |
|
It is taking time as I am trying to understand the focused index logic of OptionsList. |
|
@parasharrajat if it helps, the only place that passes the |
|
That is correct. What is the difference between |
|
So in the context of the You can see them in the images below: |
|
@luacmartins the change works and seems somewhat consistent with what we do with the index in this other line: I don't fully understand why this code makes sense, can you add a comment explaining? Did you consider another option like "disable highlights if the options are disabled"? In this case, you can't click on the options, they are just there for display, prop optionIsFocused={!this.props.disableFocusOptions
&& !this.props.isDisabled
&& !section.isDisabled
&& this.props.focusedIndex === (index + section.indexOffset)}in App/src/components/OptionsList/BaseOptionsList.js Lines 158 to 170 in 066018a Or another options is to pass |
Funny you asked, because that was the first solution that I tried and it works! However, I felt like it was kind of a workaround to me since what caused the issue was focusing on that option in the first place instead of having the input focused by default. I don't feel strongly though, so I can use the disable the highlights if the option is disabled approach if we think that's more intuitive. |
|
Updated with the "disable highlight if option is disabled" solution! |
Was the initial solution to change the focus index to if the answer is yes to both, I feel like moving the index to Having said that, the stuff about disabling the highlight for disabled option lists also don't convince me 100%, but I feel it is a bit easier to understand to me... unless you added a comment to the index calculation explaining that ternary. PD: I'm just divided about what is the best, I don't mean to criticize the approach/current solution or past solution. Just trying to communicate my thoughts in case they are of some use. |
Yea, this was it. I agree with what you said above and I don't feel strongly about any particular solution and I also agree that disabling the focus highlight is more intuitive so let's go with that! As always, thanks for the review! |
|
Bump @parasharrajat! |
|
I will test it sometime. I really don't remember the |
|
@parasharrajat we changed the solution and are now just disabling focus if the input is disabled. |
|
Ping @parasharrajat |
|
Sorry for the delay, Checking now. |
|
I completely agree that this does not make sense. It needs a comment. Are we setting to focusedIndex to nothing as there won't be any item in the list with I am trying to understand the root cause of this issue which is still unclear to me. I am fine with disabling the highlight when the option is disabled which fixes this issue. But the real problem is why changing the language(change detection cycle) caused the focus. I think we should also fix that it might come back for other lists where options are not disabled and the selection list is empty. Can someone help me understand that? |
|
Here's what I think that does:
We only seem to have that logic as a default for the state though. When we change languages and the component re-renders, we hit this logic instead, which does not account for the |
How is this working? I mean where are we focusing the TextInput? |
|
It means there is no role of |
|
Correct! It just prevents the option from being focused, since we focus the TextInput instead. |
Screenshots🔲 iOS / nativescreen-2023-02-01_06.53.21.mp4🔲 iOS / Safariscreen-2023-02-01_06.58.50.mp4🔲 MacOS / Desktopscreen-2023-02-01_06.51.02.mp4🔲 MacOS / Chromescreen-2023-02-01_06.33.13.mp4🔲 Android / Chromescreen-2023-02-01_06.34.32.mp4🔲 Android / nativescreen-2023-02-01_06.38.58.mp4 |
There was a problem hiding this comment.
LGTM. Fixes the issue.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified tests pass on all platforms & I tested again on:
- Android / native
- Android / Chrome
- iOS / native
- iOS / Safari
- MacOS / Chrome / Safari
- MacOS / Desktop
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick). - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text shown in the product is localized by adding it to
src/languages/*files and using the translation method - I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
- I verified any copy / text that was added to the app is correct English and approved by marketing by adding the
Waiting for Copylabel for a copy review on the original GH to get the correct copy. - I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */ - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor) - Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If any new file was added I verified that:
- The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If a new page is added, I verified it's using the
ScrollViewcomponent to make it scrollable when more elements are added to the page. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
cc: @aldo-expensify
🎀 👀 🎀 C+ reviewed
|
@luacmartins So do you think we should also fix the root cause as explained in #14502 (comment)? This means also adding logic to fix the focusedIndex in |
|
Haha I think that's what my first solution tried to address, but TBH I think we should get rid of the |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.2.64-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|
1 similar comment
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|


Details
Prevents the
focusedIndexbeing set to 0 when theIOUConfimationListcomponent updatesFixed Issues
$ #14441
Tests
+ > Request money/Send money > Enter Amount > Select participant > Confirmation pageSettings > Preferencesand change the selected languageOffline tests
N/A
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov