-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix: Form validation runs on blur in New task details page #24011
Fix: Form validation runs on blur in New task details page #24011
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@eVoloshchak 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] |
While testing on Safari, I found out that the active text input was forced to re-focused by this (made by #21656): App/src/components/TextInput/index.js Lines 20 to 27 in 5034433
which re-triggered Why does this not happen on Chrome? Because on Chrome , if Moreover, the original issue of #21656 only happens in mWeb Chrome. I have tried removing the changes, tested on all platforms and the app still worked as expected (i.e. keyboard still opens on focused element even when we switch to other tabs), attached video below. Thus, I suggested adding the Screen.Recording.2023-08-02.at.03.36.26.movcc @akinwale, @parasharrajat as you're the authors of the PR. |
Bump @eVoloshchak. |
src/components/TextInput/index.js
Outdated
@@ -19,7 +20,7 @@ class TextInput extends React.Component { | |||
|
|||
// Forcefully activate the soft keyboard when the user switches between tabs while input was focused. | |||
this.removeVisibilityListener = Visibility.onVisibilityChange(() => { | |||
if (!Visibility.isVisible() || !this.textInput || DomUtils.getActiveElement() !== this.textInput) { | |||
if (!Browser.isMobileChrome() || !Visibility.isVisible() || !this.textInput || DomUtils.getActiveElement() !== this.textInput) { |
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 breaks the original implementation. You will find more summary on the issue and 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.
Can you specifically point out what it did break? As I've tested on both Safari (attached above) and Chrome (attached below), it still worked.
video_2023-08-03_18-09-19.mp4
In short, the original issue only happened on Chrome, Safari would be fine without the PR. The only thing that is not right without it is:
iOS Safari: The soft keyboard does not remain open (due to a system limitation which only allows the soft keyboard to be open from a user interaction event). The screen automatically scrolls to the email input.
On iOS Safari, the keyboard still opens but screen won't scroll automatically until we type.
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 will check it and let you know later. But it was my intuition that it might break. I wasn't sure on that.
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 in advance!
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.
Run the tests from #21656 and make sure they are intact.
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.
cc @eVoloshchak
} | ||
}, 200); | ||
// Only run validation when user proactively blurs the input. | ||
if (Visibility.isVisible() && Visibility.hasFocus()) { |
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.
Always prefer early returns.
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 but we still have other codes below which are not relating to the check.
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.
Maybe move the other code above this if block if there are no issue with it and then use return.
@eVoloshchak Let me know your thoughts here when you have time. |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-07.at.17.51.18.movMobile Web - Chromescreen-20230807-175626.mp4Mobile Web - SafariScreen.Recording.2023-08-07.at.17.55.19.movDesktopScreen.Recording.2023-08-07.at.17.54.26.moviOSScreen.Recording.2023-08-07.at.17.57.02.movAndroidscreen-20230807-175332.mp4 |
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.
Both tests for this and #21656 are working good
@parasharrajat, huge thank you for weighing in on this |
✋ 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/thienlnam in version: 1.3.51-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.51-2 🚀
|
🚀 Deployed to staging by https://github.com/thienlnam in version: 1.3.52-0 🚀
|
🚀 Deployed to staging by https://github.com/thienlnam in version: 1.3.52-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.52-5 🚀
|
Details
Form validation runs inadvertently when the page is blurred. This PR fixes that.
Fixed Issues
$ #23552
PROPOSAL: #23552 (comment)
Tests
Offline tests
NA
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
Screen.Recording.2023-08-01.at.22.56.39.mov
Mobile Web - Chrome
video_2023-08-01_23-20-19.mp4
Mobile Web - Safari
Screen.Recording.2023-08-02.at.03.15.47.mov
Desktop
Screen.Recording.2023-08-02.at.00.11.59.mov
iOS
Screen.Recording.2023-08-01.at.23.19.50.mov
Android
Screen.Recording.2023-08-02.at.00.56.02.mov