-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Auto focus Message input field on workspace invite member page #18791
Auto focus Message input field on workspace invite member page #18791
Conversation
@hayata-suenaga @mollfpr 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] |
Reviewer Checklist
Screenshots/VideosWeb18791.Web.movMobile Web - Chrome18791.mWeb.Chrome.movMobile Web - Safari18791.mWeb.Safari.mp4Desktop18791.Desktop.moviOS18791.iOS.mp4Android18791.Android.mov |
@PrashantMangukiya @hayata-suenaga Coming from my curiosity, should we also make the input focus after refresh? |
I think it is also possible option. If we have to do this then we have to remove code from componentDidMount() {
this.focusTimeout = setTimeout(() => {
this.welcomeMessageInputRef.focus();
// Below condition is needed for web, desktop and mweb only, for native cursor is set at end by default.
if (this.welcomeMessageInputRef.value && this.welcomeMessageInputRef.setSelectionRange) {
const length = this.welcomeMessageInputRef.value.length;
this.welcomeMessageInputRef.setSelectionRange(length, length);
}
}, CONST.ANIMATED_TRANSITION);
}
componentWillUnmount() {
if (!this.focusTimeout) {
return;
}
clearTimeout(this.focusTimeout);
} |
@PrashantMangukiya Let's try your suggestion above. |
@mollfpr Pushed updated code to support focus after refresh. Please let me know if anything else is needed. It will be great if we can merge PR asap, so eligible for timeline bonus. Thank you. |
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.
Nice work @PrashantMangukiya! It tests well 👍
All yours @hayata-suenaga
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.
Trigger again the PR checklist check.
@hayata-suenaga It will be great if we can merge PR, so it will be eligible for timeline bonus. Thank you. |
@PrashantMangukiya I left a comment above. It's strongly discouraged to use |
@hayata-suenaga As we have to set focus during browser refresh also, here time out is needed to set focus during componentDidMount. Also our BaseTextInput component using timeout to set focus on App/src/components/TextInput/BaseTextInput.js Lines 63 to 66 in 896ad77
So here If we have to avoid timeout then we can go with original proposed solution, but that will not focus during page refresh so we implemented this. Thank you. |
@PrashantMangukiya with I'd appreciate it if you could expand on that a little bit why can't be listen to animation end event? |
@hayata-suenaga by setting timeout we can make sure that it will finish transition and then set focus. Previously we use the solution based on the onEnteryTransitionEnd() as per my initial proposal here But within that, focus was not set when browser refresh. So to make focus work during browser refresh we used timeout based solution. So this solution is working in both situation i.e.normal navigation and browser refresh. So this is my thought to use this solution. Please let me know if you have different idea that will achieve the same goal. Thank you. |
Thank you for the detailed explanation. Although I understand the reasoning, I'm curious if anyone has a solution that doesn't use so I opened up a thread in #expensify-open-source Slack channel. |
from the above Slack thread, we determined that we have no other good choice but to use |
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/hayata-suenaga in version: 1.3.16-0 🚀
|
@PrashantMangukiya, the QA for this PR has failed the original issue has not been on mWeb Safari and iOS. can you investigate? |
@mvtglobally @hayata-suenaga I tested it, this issue is fixed for iOS and Mweb as shown video here. MWeb SafariMweb-Safari.moviOSiOS.mov |
@PrashantMangukiya thank you for testing again. I'll update the QA team if they can redo the tests again |
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
1 similar comment
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
@hayata-suenaga team is still able to repro https://github.com/Expensify/App/assets/43995119/d442df5f-81d8-4871-86a8-ce27a3af0b0d |
@PrashantMangukiya can you test it again with staging changes? |
Issue is not repro on IOS 16.4 |
@mvtglobally For Staging Mweb Safari it is not reproduce in emulator. I can see you have real device, where it shows green bottom line (due to focus in input) but does not show cursor. This is strange behaviour. Not any idea at present, I will investigate more about this. cc: @hayata-suenaga Stg-Mweb-Safari.mp4 |
@hayata-suenaga @mvtglobally I did some investigation on MWeb focus issue for real device and found out that this issue is not specific to our PR, but it is in many places in our App (maybe due to faulty TextInput component) having same behaviour i.e. TextInput focused but cursor does not show. Below are few videos recorded on Real Device MWeb Safari. New Contact MethodNew-Contact-Method.MP4Change PasswordChange-Password.MP4Add PayPalAdd-PayPal.MP4New ChatNew-Chat.MP4New GroupNew-Group.MP4Send Money DescriptionSend-Money-Desc.MP4Request Money DescriptionRequest-Money-Desc.MP4Split Bill DescriptionSplit-Bill-Desc.MP4Assign Task TitleAssign-Task-Title.MP4Assign Task DescriptionAssign-Task-Desc.MP4I think we can create a new issue for this. |
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
@PrashantMangukiya can you report the bug to #expensify-open-source channel? this is very weird... the text input is focused but the cursor is not being shown and the keyboard is not shown up... |
@hayata-suenaga Should I report this to #expensify-open-source OR #expensify-bugs channel? Generally we report bug on #expensify-bugs channel so I am asking to verify it. Thank you. |
@hayata-suenaga Cursor missing in mWeb Safari related issue already reported #19608 so I think no need to report again. Thank you. |
// Below condition is needed for web, desktop and mweb only, for native cursor is set at end by default. | ||
if (this.welcomeMessageInputRef.value && this.welcomeMessageInputRef.setSelectionRange) { | ||
const length = this.welcomeMessageInputRef.value.length; | ||
this.welcomeMessageInputRef.setSelectionRange(length, length); | ||
} |
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 is caused a regression here #20875 (comment).
Why do we need this?
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.
Why is #20875 a regression of this?
On the native the cursor is set at the end of the text, so we want the same behavior for the web and desktop.
@hayata-suenaga @mollfpr PR is ready for review.
Details
Whenever we select member from Invite member screen, and tap Next button it will show Add message screen. On this screen there is a Message input field that was not auto focused until now. So in this pr we added logic to autofocus the Message input field.
Fixed Issues
$ #18371
PROPOSAL: #18371 (comment)
Tests
Offline tests
QA Steps
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
Chrome
Web-Chrome.mov
Safari
Web-Safari.mov
Mobile Web - Chrome
MWeb-Chrome.mov
Mobile Web - Safari
MWeb-Safari.mov
Desktop
Desktop.mov
iOS
iOS.mov
Android
Android.mov