-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix/16098: Listen keydown from user to focus again the composer #17138
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
Conversation
|
@PauloGasparSv @rushatgabhane 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] |
|
Won't be able to review this Today but will prioritize it on Monday! |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-04-10.at.13.21.06.movMobile Web - ChromeN.A.Mobile Web - SafariN.A. DesktopScreen.Recording.2023-04-10.at.14.15.16.mov |
rushatgabhane
left a comment
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.
@tienifr nice polish to the UX!
Left a few minor style change requests
| @@ -0,0 +1,5 @@ | |||
| function listenKeyDown(callback) { | |||
| document.addEventListener('keydown', callback); | |||
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.
@tienifr nitpick: style change -
condense listenKeyDown and removeListenKeyDown to a single file.
| } | ||
|
|
||
| componentWillUnmount() { | ||
| removeListenKeyDown(this.keydownListener); |
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 should perform this only if keydownListener is not null
| removeListenKeyDown(this.keydownListener); | |
| if (this.keydownListener) { | |
| removeListenKeyDown(this.keydownListener); |
Co-authored-by: Rushat Gabhane <rushatgabhane@gmail.com>
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.
@PauloGasparSv LGTM! 🎉
appreciate the quick work @tienifr 🚀
|
Hey, the changes here are looking great!!! I'm testing on all platforms here too. I'm testing if it's ok to introduce the following behavior though. In Web/Desktop if we have a chat open and we access the Profile Settings (or any other "page") and start typing stuff it will focus on the composer and add the input there. That makes total sense but may be confusing to the user, for example in Desktop Web: Screen.Recording.2023-04-10.at.10.26.27.movAnd Desktop Web with a small screen (mobile mode). This one may be a problem but I don't think it's worth solving since no one will probably use the Web version like this. mWeb.Desktop.movI'm checking if this happens on mWeb too and if there is a simple fix for this. If there isn't IMO we should send a message in #expensify-open-source to get other people's opinions (mine is Do Nothing). |
|
@tienifr is there a simple solution to the problems @PauloGasparSv mentioned maybe? Can we check if the page is active? |
|
@rushatgabhane Please help to check my small fix for the above problem |
|
@tienifr instead of checking visibility inside component did update, can we modify the callback function for the event listener to return early if modal isn't visible? |
|
@rushatgabhane Your suggestion is so great. Just updated |
|
Amazing!!! Re-testing here in a bit! |
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.
rushatgabhane
left a comment
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.
@PauloGasparSv nice catch with the bug related to RHN
LGTM!
Screen.Recording.2023-04-11.at.00.19.49.mov
Screen.Recording.2023-04-11.at.00.18.18.mov
|
@PauloGasparSv Just updated |
PauloGasparSv
left a comment
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!
Web
Screen.Recording.2023-04-12.at.13.55.45.mov
Desktop
Screen.Recording.2023-04-12.at.14.02.49.mov
iOS Native
Screen.Recording.2023-04-12.at.14.31.49.mov
iOS mWeb
Screen.Recording.2023-04-12.at.14.34.56.mov
Android Native
Screen.Recording.2023-04-12.at.14.57.10.mov
Android mWeb
Screen.Recording.2023-04-12.at.14.45.41.mov
|
Hey @tienifr can you also mention in the QA steps that the behaviour should only work for Desktop and Desktop Web? |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Hey guys! just noticed a regression reported it here, |
|
🚀 Deployed to staging by https://github.com/PauloGasparSv in version: 1.3.0-0 🚀
|
|
Is this a deploy blocker? |
|
Taking a look at that, I think everyone else is out right now. |
|
There are many regressions being reported from this PR. Can we please revert this @rushatgabhane? Let me know if you need a hand with that. |
Was about to comment that after seeing this. |
|
We should also revert #17360 |
|
Yes and then work on a new PR with all the fixes merged and everything tested. We can just also skip the issue as I don't see a strong need to have that feature. |
|
Bump @tienifr too, can you take a look at this and help revert both P.R.'s? |
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.0-2 🚀
|
|
🚀 Deployed to staging by https://github.com/PauloGasparSv in version: 1.3.1-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/PauloGasparSv in version: 1.3.1-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.1-3 🚀
|



Details
We should automatically focus on the Composer if we press on regular characters like a, b, c, d, ... (not non-character keys like Enter, Shift) when we're not typing on any input or textarea.
Fixed Issues
$ #16098
PROPOSAL: #16098 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Screen.Recording.2023-04-08.at.00.50.34.mov
Mobile Web - Chrome
RPReplay_Final1680890370.mp4
Mobile Web - Safari
RPReplay_Final1680890255.mp4
Desktop
Screen.Recording.2023-04-08.at.01.07.15.mov
iOS
Screen-Recording-2023-04-08-at-01.06.13.mp4
Android
Screen.Recording.2023-04-08.at.01.27.23.mov