-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[$250] Compose box - Browser's back arrow do not focus composer if first image preview open #42368
Comments
Triggered auto assignment to @jliexpensify ( |
Job added to Upwork: https://www.upwork.com/jobs/~013929a859819a7038 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
Can repro, adding |
ProposalPlease re-state the problem that we are trying to solve in this issueBrowser back button open other images when user opens first attachment image in attachment view (and won't close attachment view) and press the back button. What is the root cause of the problem?In here: App/src/libs/Navigation/AppNavigator/AuthScreens.tsx Lines 152 to 157 in e8ae3c5
When back button is pressed, the App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 283 to 284 in e8ae3c5
App/src/components/Composer/index.tsx Line 324 in e8ae3c5
autofocus to be true. More info about image changes in attachment view@DylanDylann Focus event catch by react native modal The function of this file based on the comment is to trap focus so the focus won't leave modal, if the focus is outside of modal, the trap focus will focus last element inside modal. The code flow is: Composer focused (from autofocus of RNMarkdownTextInput)-> focus event triggered -> catch by trapFocus (which will try to focus child or last descendant element of the modal -> trap focus looping through descendant element -> until last element of the initial rendered image (initialNumToRender is 3 in AttachmentCarousel) list reached : App/src/pages/home/report/ReportAttachments.tsx Lines 21 to 25 in 8375abe
which is navigate back to the attachment modal. Focus event catch by react native modal The function of this file based on the comment is to trap focus so the focus won't leave modal, if the focus is outside of modal, the trap focus will focus last element inside modal. The code flow is: Composer focused (from autofocus of RNMarkdownTextInput)-> focus event triggered -> catch by trapFocus (which will try to focus child or last descendant element of the modal -> trap focus looping through descendant element -> until last element of the initial rendered image (initialNumToRender is 3 in AttachmentCarousel) list reached : App/src/pages/home/report/ReportAttachments.tsx Lines 21 to 25 in 8375abe
which is navigate back to the attachment modal. What changes do you think we should make in order to solve the problem?So basically we prevent set modal visibility too early, in here we should add a condition: App/src/libs/Navigation/AppNavigator/AuthScreens.tsx Lines 155 to 156 in e8ae3c5
the code could be:
This will check whether all modals is hidden completely. App/src/components/Modal/BaseModal.tsx Line 76 in e8ae3c5
The modal already use it and so the if check above is sufficient to fix this issue. To solve the closed issue that reappears above, in baseModal, we should call hide modal only in here: App/src/components/Modal/BaseModal.tsx Line 244 in e8ae3c5
so we add hideModal inside Result:back.button.issue.fix.mp4Fix result for the other issue that reappears:other.issue.fix.result.mp4 |
ProposalPlease re-state the problem that we are trying to solve in this issue.When an image attachment is opened inside a chat, pressing the browser back button will result in another image displaying, rather than being navigated back to the chat. What is the root cause of that problem?Inside the AttachmentCarousel component, the updatePage function is unexpectedly being called when the browser back button is pressed (due to how What changes do you think we should make in order to solve the problem?We should detect when the back button is pressed (potentially using a ref) and then return early inside the updatePage function. This will ensure that we're not unnecessarily fetching a different image and navigating the user to it. It will allow the user to go back to the chat What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Compose box - Browser's back arrow do not focus composer if first image preview open This issue is reproducible for video attachments as well. What is the root cause of that problem?In What changes do you think we should make in order to solve the problem?We should add What alternative solutions did you explore? (Optional) |
📣 @CleverWolf1220! 📣
|
@jliexpensify, I won't be able to review this soon. Please reassign. |
I would love to take over this issue as C+ |
📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
All yours @DylanDylann! EDIT: Still considering proposals! |
@tsa321 Could you detail this point? Which logic does that?
|
@arjun-dureja Could you deep dive into this point and explain why the updatePage is called? Is there any reference, document that explain why onViewableItemsChanged is triggered?
|
@CleverWolf1220 Why waitForInteraction will resolve this problem? |
@DylanDylann Focus event catch by react native modal The function of this file based on the comment is to trap focus so the focus won't leave modal, if the focus is outside of modal, the trap focus will focus last element inside modal. The code flow is: Composer focused (from autofocus of RNMarkdownTextInput)-> focus event triggered -> catch by trapFocus (which will try to focus child or last descendant element of the modal -> trap focus looping through descendant element -> until last element of the initial rendered image (initialNumToRender is 3 in AttachmentCarousel) list reached : App/src/pages/home/report/ReportAttachments.tsx Lines 21 to 25 in 8375abe
which is navigate back to the attachment modal. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@jliexpensify, @DylanDylann Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Hi Melv, thanks for tagging me. I will complete my review today |
Sorry for late response. I found that my proposal solves this issue but causes other problems. |
Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Ooh, that's complicated. I think this solution makes sense to me, but we should make sure to do a lot of testing on closing other modals, etc. to make sure this doesn't cause any regressions there. Assigining @tsa321 |
📣 @tsa321 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@DylanDylann there wasn't a regression, right? |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.74-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: N/A
Issue reported by: Applause - Internal Team
Action Performed:
Precondition: upload multiple images in chat
Expected Result:
Composer gets focused
Actual Result:
Last uploaded image preview opened
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6481495_1715770820384.multiple_image.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @thesahindiaThe text was updated successfully, but these errors were encountered: