-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Form validation runs on blur in New task details page #24011
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
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import BaseTextInput from './BaseTextInput'; | |
import * as baseTextInputPropTypes from './baseTextInputPropTypes'; | ||
import DomUtils from '../../libs/DomUtils'; | ||
import Visibility from '../../libs/Visibility'; | ||
import * as Browser from '../../libs/Browser'; | ||
|
||
class TextInput extends React.Component { | ||
componentDidMount() { | ||
|
@@ -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 commentThe 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 commentThe 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.mp4In 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:
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 commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. cc @eVoloshchak |
||
return; | ||
} | ||
this.textInput.blur(); | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.
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.