-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[DateInput/DateRangeInput] Commit typed value on 'Enter' key press #1825
Conversation
Fix testPreview: documentation |
does this PR change any interaction? +1 on reverting to previous value on |
@llorca no, it should be strictly additive. |
Merge branch 'master' into cl/1798-dri-enter-keyPreview: documentation |
packages/datetime/src/dateInput.tsx
Outdated
const nextDate = fromMomentToDate(nextValue); | ||
this.handleDateChange(nextDate, true); | ||
this.inputRef.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.
Whoops, need to do this.safeInvokeInputProp("onKeyDown", e);
.
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.
@cmslewis is this comment still relevant?
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.
looks good but there are some unresolved comments from you @cmslewis
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.
actually, not a fan of the blur
behavior.
packages/datetime/src/dateInput.tsx
Outdated
const nextValue = this.createMoment(this.state.valueString); | ||
const nextDate = fromMomentToDate(nextValue); | ||
this.handleDateChange(nextDate, true); | ||
this.inputRef.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.
🤔 this .blur()
feels intuitively wrong, as it kills the focus flow: I can't hit enter
and then tab
to move to the next form input.
can we do everything else but simply not blur? same goes for DRI.
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 buy that.
Fix blur interactionsPreview: documentation |
@giladgray is this good to merge? |
@cmslewis pressing |
seems fine to address in a follow up. current behavior seems fine to me. @erinmarchand @LindsayWard @dalessi can you verify in the "documentation" link above? |
wait @adidahiya how is this fine to merge? it literally doesn't work properly in one of the title use cases. |
It seems to address the original intent of the filed issue though. Once you type something in DateInput, you get it committed when you blur out of the input (the popover gets closed, which suggests to the user that something worked -- this was not the case before this PR). Seems reasonable in most cases, and we can make further adjustments if we get more feedback. But I'm also cool with waiting to hear from the people tagged in my last comment ^ |
Check out this GIF: Not a fan of that inconsistency, as @giladgray pointed out. |
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.
DI should update input value on enter
, just like DRI. It currently happens on blur
@llorca @adidahiya @giladgray Sorry for the delay. Should be good to go now. |
Format the date string on Enter in DateInputPreview: documentation | landing | table |
nice, lgtm 👍 |
…1825) * DateInput now saves on Enter * DateRangeInput now saves on Enter * Write DateInput tests, fix locale bug * Tests + bug fixes for DateRangeInput * Fix test * Fix blur interactions * Close the popover on Shift + TAB * Format the date string on Enter in DateInput
Fixes #1798
Checklist
Changes proposed in this pull request:
DateInput
andDateRangeInput
now save the typed value(s) on Enter.Reviewers should focus on:
Screenshot
DateInput
DateRangeInput