-
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 input lost focus when entering on no result found #28459
Conversation
@0xmiroslav 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] |
@@ -515,6 +516,7 @@ class EmojiPickerMenu extends Component { | |||
onFocus={() => this.setState({isFocused: true, highlightedIndex: -1, isUsingKeyboardMovement: false})} | |||
onBlur={() => this.setState({isFocused: false})} | |||
autoCorrect={false} | |||
blurOnSubmit={this.state.searchTerm.length > 0 && this.state.filteredEmojis.length > 0} |
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.
Any reason to prevent blur when no input?
OptionsList, SelectionList (after fix) still blurs when search text is empty.
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.
@0xmiroslav Just prevent blurring this input when submitting if no result found
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.
Do you think we don't need to check searchTerm, when searchTerm is empty the list will not empty.
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 it's better UX to keep focus in that case.
Actually emoji search and selection list are different.
In selection list, both input and result are focused so when press Enter key while showing result, it triggers selected item.
But in emoji search, both cannot be focused together.
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.
So what should we do in emoji picker?
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.
your current change looks good to me
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.
So that means I don't need to update any thing else, right?
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.
Weird behavior on mSafari
msafari.mov
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.
Confirmed this happens on main
@@ -402,7 +403,7 @@ class EmojiPickerMenu extends Component { | |||
const newFilteredEmojiList = EmojiUtils.suggestEmojis(`:${normalizedSearchTerm}`, this.props.preferredLocale, this.emojis.length); | |||
|
|||
// Remove sticky header indices. There are no headers while searching and we don't want to make emojis sticky | |||
this.setState({filteredEmojis: newFilteredEmojiList, headerIndices: [], highlightedIndex: 0}); | |||
this.setState({filteredEmojis: newFilteredEmojiList, headerIndices: [], highlightedIndex: 0, searchTerm}); |
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.
@0xmiroslav Updated. Do you think we also should add blurOnSubmit
to index.native.js
?
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.
For consistency, let's remove searchTerm
logic and only check filteredEmojis.length
on both web and native.
Do you agree?
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.
That makes sense to me.
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.
@0xmiroslav I updated.
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
✋ 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/nkuoch in version: 1.3.78-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.78-4 🚀
|
🚀 Deployed to staging by https://github.com/nkuoch in version: 1.3.79-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
Details
When the search has no result and the user uses the enter key, we should keep the input is focused
Fixed Issues
$ #28072
PROPOSAL: #28072 (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
Screen.Recording.2023-09-29.at.16.49.08.mov
Mobile Web - Chrome
Record_2023-09-29-16-51-49.mp4
Mobile Web - Safari
Screen.Recording.2023-09-29.at.16.55.02.mov
Desktop
Screen.Recording.2023-09-29.at.17.34.22.mov
iOS
Screen.Recording.2023-09-29.at.17.22.44.mov
Android
Screen.Recording.2023-09-29.at.17.28.32.mp4