-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(lemon): remove buggy delay from _onBlur for LemonInputSelect #26400
Conversation
@benjackwhite I know it's a deep cut from a while ago but curious if you remember any context around |
Size Change: 0 B Total Size: 1.11 MB ℹ️ View Unchanged
|
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
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.
Seems fine and safe to me, but good call asking Ben for original context, and I'd wait to hear from him before shipping if this can wait a few days – it doesn't look like this is urgently affecting the customer, so we should be okay to be a bit cautious.
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated4 snapshot changes in total. 0 added, 4 modified, 0 deleted:
Triggered by this commit. |
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.
Oooh i hope this doesn't break anything... It was too long ago for me to know why this mattered but be aware if it does break it might be a very obscur change so please test heavily
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 this is fine though |
That's interesting thanks for the callout! I feel like since there's an explicit "Add <typed_text>` button, this is a pretty good tradeoff as-is; losing one bit of convenience, but fixing a quite annoying and finicky bug. Regardless, I'll timebox and see if I can achieve both! |
@Twixes thanks for the callout there - was able to get the "click outside popover adds custom value" functionality back as well: https://www.loom.com/share/ec54ef15771749b98d5ae11354cbb496 ! |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
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.
Perfect 🙌
896307e
to
b97aa2f
Compare
Problem
Addresses issue described here: https://posthoghelp.zendesk.com/agent/tickets/20603
The problem: When clicking on an item from the popover which does not match the text input, the delayed
_onBlur
typically runs after the_onActionItem
, reverting the selection back as can be seen in the LoomNote - currently with the delay, this is a race condition. However when we remove the delay, the click action runs the _onActionItem, and because the popover is present during the click, the
_onBlur
will then go into its early return conditionif (popoverFocusRef.current) {
, which closes the popover, focuses the text input, and does not try to set any state values, which feels like the exact desired behaviorGiven the deleted comment, I also tested all sorts of clicks in or around the popover, opening other popovers, etc and I can not find any adverse effects of removing this delay, but I'm wondering if @benjackwhite has any thoughts here as he added the delay initially when creating this component!
Changes
Remove the
setTimeout
wrapping_onBlur
for LemonInputSelectDoes this work well for both Cloud and self-hosted?
Yes
How did you test this code?
https://www.loom.com/share/ec54ef15771749b98d5ae11354cbb496