Skip to content
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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

evansjohnson
Copy link
Contributor

@evansjohnson evansjohnson commented Jun 28, 2024

Fixes #6879

Checklist

  • Includes tests
  • [n/a] Update documentation

Changes proposed in this pull request:

Respect precision passed to timePickerProps as well as the root timePrecision prop when considering for focus.

Reviewers should focus on:

  • Any mistakes
  • Anywhere else I may have missed
  • Worth sharing the implementation between components?

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

@changelog-app
Copy link

changelog-app bot commented Jun 28, 2024

Generate changelog in packages/datetime2/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Fix DateRangeInput3 focus with timePrecision

Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

diff

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

add more tests and fix more tests

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

format lint

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@gluxon gluxon self-assigned this Jun 28, 2024
Comment on lines +301 to +302
// if timePickerProps is defined, the `TimePicker` will render with it's default `precision`
return timePickerProps != null ? TimePicker.defaultProps.precision : undefined;
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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
Copy link
Contributor

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.

@evansjohnson evansjohnson requested a review from gluxon July 3, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Focus issues with DateRangeInput3 if timePickerProps.precision is set
3 participants