Skip to content

Conversation

@liuliu-dev
Copy link
Contributor

@liuliu-dev liuliu-dev commented Nov 12, 2025

Closes #4488

Changelog

  1. Fixed focus behavior for date/time inputs

    • Modified focusInput handler to check the focused element before resetting the forcus, if it's a date picker, avoid resetting focus to input.
  2. Fixed Playground story for controlled date/time inputs

    • Added onInput handler alongside onChange to ensure value updates work correctly with native date/time pickers

Rollout strategy

  • Patch release

Testing & Reviewing

Merge checklist

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: b3a057e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 12, 2025
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot temporarily deployed to storybook-preview-7189 November 12, 2025 22:25 Inactive
@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 12, 2025
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 12, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 12, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7189 November 12, 2025 23:56 Inactive
@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/6766

@primer-integration
Copy link

🟢 ci completed with status success.

@liuliu-dev liuliu-dev marked this pull request as ready for review November 13, 2025 17:22
@liuliu-dev liuliu-dev requested a review from a team as a code owner November 13, 2025 17:22
Copilot finished reviewing on behalf of liuliu-dev November 13, 2025 17:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a Safari-specific issue where clicking on date/time input pickers would reset focus, preventing proper interaction with the native date/time picker UI. The fix introduces conditional focus handling for segmented input types (date, time, datetime-local) and adds proper event handling in the Playground story for controlled date/time inputs.

Key changes:

  • Modified focusInput handler to avoid resetting focus when clicking directly on date/time inputs
  • Added onInput handler to Playground story to ensure controlled date/time inputs work correctly

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/react/src/TextInput/TextInput.tsx Added logic to detect segmented input types and conditionally prevent focus reset when the input itself is clicked
packages/react/src/TextInput/TextInput.stories.tsx Added onInput handler to Playground story for proper controlled input behavior with date/time pickers
.changeset/eleven-apes-prove.md Added changeset entry documenting the patch fix

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 13, 2025
@github-actions
Copy link
Contributor

👋 Hi, there are new commits since the last successful integration test. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

Copy link
Contributor

@llastflowers llastflowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liuliu-dev liuliu-dev added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit 424cbc5 Nov 14, 2025
49 checks passed
@liuliu-dev liuliu-dev deleted the liuliu/fix-focus-issue-in-textinput-on-safari branch November 14, 2025 22:00
@primer primer bot mentioned this pull request Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TexInput onClick focus behavior broken with type=date on Safari

3 participants