-
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: don't focus on composer when open right modal #27155
Conversation
// Restore the suggestions if onSelectionChange is not called on focused | ||
if (isSelectionChangedOnFocus || !suggestionsRef.current) { | ||
return; | ||
} | ||
suggestionsRef.current.restoreSuggestions(); |
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 is this 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.
onSelectionChange
isn't called when composer gets focused(without any selection changes) on native platforms
In this case, we can restore the previous suggestion list. Previous suggestions are stored in resetSuggestions
on blur handler
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.
Is this still needed?
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.
Without this, suggestions won't be shown unless selection is changed in native platforms. Refocusing or mouse clicking doesn't work.
src/pages/home/report/ReportActionCompose/ReportActionCompose.js
Outdated
Show resolved
Hide resolved
@s-alves10 The PR is slightly different than the approved solution. Please comment on each new section that was added explaining the need for it. |
}; | ||
|
||
const isKeyboardVisibleWhenShowingModalRef = useRef(false); | ||
const restoreKeyboardState = useCallback(() => { | ||
if (!isKeyboardVisibleWhenShowingModalRef.current) { | ||
if (!isKeyboardVisibleWhenShowingModalRef.current || !shouldFocusInputOnScreenFocus) { |
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.
We don't need to set focus manually if focus is set automatically
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 problem is this solving?
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.
We have composer focused already if shouldFocusInputOnScreenFocus
is true. In android chrome, onSelectionChange isn't called when we set focus again.
You can reproduce this with the following steps(Android chrome):
- Open any chat and input
@
to show mentions list - Click + button to open menu and tap outside of the menu to close it
- Verify that mention list doesn't show
I added some comments. |
Please take a look again |
Added some comments on the previous review comments |
If you think we should limit the scope of the PR in the issue, please let me know. |
@s-alves10 Yes, let's please limit the PR to the bugs that are linked in the issue. If a bug is found and it's a regression we should fix it, but if it's on staging/main already it's better to report it in Slack otherwise we would be working out a new solution instead of going forward with the approved one (with the exception of some bugs where the solution is straightforward). |
I removed all unrelated code. Also updated the test steps in PR description |
@@ -257,6 +261,7 @@ function AttachmentPickerWithMenuItems({ | |||
onClose={onPopoverMenuClose} | |||
onItemSelected={(item, index) => { | |||
setMenuVisibility(false); | |||
onItemSelected(); |
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.
Can we move this to be the last function call?
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.
We need to overwrite isKeyboardVisibleWhenShowingModalRef.current
value in triggerAttachmentPicker
function when selecting Add attachment
.
I think this is the ideal position this call should be placed at.
Is there any specific reason for moving?
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 you are right here.
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemweb-chrome.movMobile Web - Safarimweb-safari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
Please take a look |
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!
✋ 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/youssef-lr in version: 1.3.69-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.69-2 🚀
|
🚀 Deployed to staging by https://github.com/youssef-lr in version: 1.3.70-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.70-8 🚀
|
Details
Fixed Issues
$ #26489
PROPOSAL: #26489 (comment)
Tests
@
character and verify that mention suggestions appears+
button again and tap any menu exceptAdd attachment
Offline tests
@
character and verify that mention suggestions appears+
button again and tap any menu exceptAdd attachment
QA Steps
@
character and verify that mention suggestions appears+
button again and tap any menu exceptAdd attachment
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
26489_mac_chrome.mp4
Mobile Web - Chrome
26489_anroid_chrome.mp4
Mobile Web - Safari
26489_ios_safari.mp4
Desktop
26489_mac_desktop.mp4
iOS
26489_ios_native.mp4
Android
26489_android_native.mp4