-
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
fix keyboard flashing while clicking "Add attachment" #23994
Conversation
Please do not merge this before #18507 |
@thesahindia Please 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] |
@thesahindia, hi, if there are anything that needs to be revised, please feel free to let me know. 😄 |
We need to wait at least until PR #24184 is merged, because the attachment workflow on the main branch is currently broken. |
@ntdiary it's merged. You can continue |
Cool! @ntdiary, ping me once you resolve the conflicts. I will prioritize the review on this. P.S. Sorry for the delay! |
@thesahindia no worries. Resolved. : ) |
@thesahindia, kindly reminder for the review 🙂 |
I only need to test ios now. I will get back to it tomorrow. |
Resolve the conflict again and await review. 🙂 |
@bernhardoj, so far, based on the previous discussion, the current code only fixes the flashing issue in the attachment flow. Of course, if needed, it can also be extended to fix the IOU flow, however it requires us to first confirm the expected behavior (so we can have as consistent of a user experience across platforms as possible) 🙂 |
@situchan, a kindly reminder for the review. 🙂 |
reviewing today |
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.
I think we should fix emoji picker as well as they have the same root cause
@@ -73,6 +74,9 @@ class BaseModal extends PureComponent { | |||
this.props.onModalHide(); | |||
} | |||
Modal.onModalDidClose(); | |||
if (!this.props.fullscreen) { |
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.
what's this condition for?
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.
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.
Hey @ntdiary, I know this thread is kinda old, but would appreciate your input:
Why was it necessary to put the ComposerFocusManager.setReadyToFocus()
logic into both onDismiss
and onModalHide
(which calls hideModal
)?
Was there any drawback to just calling it in hideModal
regardless of the fullscreen
condition? This would mean removing the ReactNativeModal.onDismiss
prop below.
I'm asking because we've recently discovered another case when the onDismiss
is not called, this time for a full-screen Attachments modal.
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.
@paultsimura, when using the Modal
component, the invocation of onModalHide
happens earlier than the destruction of the focus trap, which will cause the composer not gaining focus correctly after the modal is dismissed. :)
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.
Thanks @ntdiary. Do you have any particular Modal
scenario in mind that might break?
I tried with only the hideModal
: emoji picker, attachments modal, the side drawer – everything focuses the composer correctly
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.
@paultsimura, I'm not exactly sure about the new code in the main branch, maybe you can verify the emoji picker in mobile chrome. Additionally, I'm refactoring the modal's refocusing behavior (#29199), so there might be a chance to review the related code again tomorrow. :)
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.
Cool, would your change cover the modal being closed on clicking the browser's "Back" button as well?
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.
Yeah, I added a new ModalContent
, I feel it should fix that issue.
@@ -0,0 +1,23 @@ | |||
let isReadyToFocusPromise = Promise.resolve(); |
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.
Do we need this logic on web at all?
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.
Yeah, the Modal
component in react-native-web
has focus trap. This code, together with InteractionManager.runAfterInteractions
, can also ensure that the focus
is called safely.
So we can continue to the review? |
yes, was doing thorough test. |
Inconsistency: after opening emoji picker modal while composer is not focused, composer is auto focused on modal close Screen.Recording.2023-08-23.at.8.16.40.PM.mov |
@ntdiary Opposite of Case 2 fails on android chrome, though happens on staging. Repro step:
|
@situchan, Uh, yeah, on android chrome, closing the modal will show the keyboard event if the composer was previously blurred, which is exactly what App/src/pages/home/report/ReportActionCompose.js Lines 985 to 990 in 867d61e
|
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
Above issues I mentioned already exist on main so out of scope for this PR |
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.
LGTM
@joelbettner all yours!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/joelbettner in version: 1.3.57-0 🚀
|
🚀 Deployed to staging by https://github.com/joelbettner in version: 1.3.58-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.57-6 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.58-5 🚀
|
setIsFocused(false); | ||
resetSuggestions(); | ||
if (e.relatedTarget && e.relatedTarget === actionButtonRef.current) { | ||
isKeyboardVisibleWhenShowingModalRef.current = true; |
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.
This caused a regression #26489. After setting this value to true we had to reset it to false as soon as a menu item is selected otherwise we will focus the composer for a brief period while opening the RHP.
Details
Notes:
Fixed Issues
$ #13922
PROPOSAL: #13922 (comment)
Tests
case 1:
case 2:
case 3:
Cancel
button to exit the attachment flow.case 4:
Offline tests
QA Steps
case 1:
case 2:
case 3:
Cancel
button to exit the attachment flow.case 4:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mp4
Mobile Web - Chrome
android-chrome.mp4
Mobile Web - Safari
ios-safari.mp4
Desktop
desktop.mp4
iOS
ios-app.mp4
Android
android-app.mp4