-
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
Fix DateRangeInput3 focus with timePrecision #6881
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
diffBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
add more tests and fix more testsBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
format lintBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
// if timePickerProps is defined, the `TimePicker` will render with it's default `precision` | ||
return timePickerProps != null ? TimePicker.defaultProps.precision : undefined; |
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.
A bit confused by the comment above. Will the TimePicker
still render with its default precision if timePickerProps
is undefined
?
I'm curious how important it is to return TimePicker.defaultProps.precision
vs undefined
here.
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.
because of this bit of existing behavior, which I tried to explain more here: https://github.com/palantir/blueprint/pull/6881/files#diff-d2a31417b184106fdf4054399ab49455504ff747c19714aa6df0bb7f8e26bf90R238-R239
let me know any suggestions you can think of to help clarify this
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.
if timePickerProps
is not defined, the underlying DateRangePicker
will have default timePickerProps
, and therefor not show the time pickers - so in that case we say the precision is `undefined.
if timePickerProps
is defined, we return the default precision
, since at this point in this method we already would have returned an explicitly defined precision either directly on this component, or from the timePickerProps
it("<TimePicker /> should not lose focus on increment/decrement with up/down arrows", () => { | ||
const { root } = wrap(<DateRangeInput3 {...DATE_FORMAT} timePrecision={TimePrecision.MINUTE} />, true); | ||
describe("<TimePicker /> focus", () => { | ||
// there are multiple ways to render the underlying TimePicker component so run same tests on all |
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.
Nice coverage of tests! I like that we're checking all these variants.
Fixes #6879
Checklist
Changes proposed in this pull request:
Respect
precision
passed totimePickerProps
as well as the roottimePrecision
prop when considering for focus.Reviewers should focus on:
Reproducer
See linked issue
Recordings
Develop:
https://github.com/palantir/blueprint/assets/14102129/5e07692f-f433-40aa-af95-3da76cbef0f3
This PR:
https://github.com/palantir/blueprint/assets/14102129/042d91bc-81a2-4198-8066-89484b771387