-
Notifications
You must be signed in to change notification settings - Fork 645
Prevent focus reset on date/time input clicks in Safari #7189
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
Prevent focus reset on date/time input clicks in Safari #7189
Conversation
🦋 Changeset detectedLatest commit: b3a057e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
👋 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 |
|
👋 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 |
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/6766 |
|
🟢 ci completed with status |
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.
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
focusInputhandler to avoid resetting focus when clicking directly on date/time inputs - Added
onInputhandler 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 |
|
👋 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 |
llastflowers
left a comment
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.
✨
Closes #4488
Changelog
Fixed focus behavior for date/time inputs
focusInputhandler to check the focused element before resetting the forcus, if it's a date picker, avoid resetting focus to input.Fixed Playground story for controlled date/time inputs
onInputhandler alongsideonChangeto ensure value updates work correctly with native date/time pickersRollout strategy
Testing & Reviewing
Merge checklist