-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: Attachments reopen on multiple 'esc' click and hang on browser's navigation back #31524
Changes from all commits
487a794
b9b0f60
086e606
0e6d7ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; | |||||||||||||
import React, {useCallback} from 'react'; | ||||||||||||||
import _ from 'underscore'; | ||||||||||||||
import AttachmentModal from '@components/AttachmentModal'; | ||||||||||||||
import ComposerFocusManager from '@libs/ComposerFocusManager'; | ||||||||||||||
import Navigation from '@libs/Navigation/Navigation'; | ||||||||||||||
import * as ReportUtils from '@libs/ReportUtils'; | ||||||||||||||
import ROUTES from '@src/ROUTES'; | ||||||||||||||
|
@@ -38,7 +39,11 @@ function ReportAttachments(props) { | |||||||||||||
defaultOpen | ||||||||||||||
report={report} | ||||||||||||||
source={source} | ||||||||||||||
onModalHide={() => Navigation.dismissModal()} | ||||||||||||||
onModalHide={() => { | ||||||||||||||
Navigation.dismissModal(); | ||||||||||||||
// This enables Composer refocus when the attachments modal is closed by the browser navigation | ||||||||||||||
ComposerFocusManager.setReadyToFocus(); | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @abdulrahuman5196 I decided to go with my alternative solution for the Composer refocus on navigation because removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this change? What does change bring in? @paultsimura There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This focuses the composer when we navigate back by clicking the browser's "Back" button. Otherwise, App/src/components/Modal/BaseModal.tsx Lines 115 to 117 in d521dd6
App/src/components/Modal/BaseModal.tsx Lines 66 to 68 in d521dd6
The |
||||||||||||||
}} | ||||||||||||||
onCarouselAttachmentChange={onCarouselAttachmentChange} | ||||||||||||||
/> | ||||||||||||||
); | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. What does this change provide?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I just moved
Modal.willAlertModalBecomeVisible(false)
from 2useEffect
hooks intohideModal
.This removes the race condition when double-clicking the
esc
button, as thehideModal
is eventually called after each of those hooks, thereforeModal.willAlertModalBecomeVisible(false)
will be called when the modal gets hidden. Without this change, the composer won't get focused when double-clickingesc
.I asked the original author here - there was no specific reason to put this call inside the hooks instead of the
hideModal
: #27639 (comment)