fix(date-picker): add proper focus highlighting - #326
Closed
PraveenKum11 wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes focus-visible highlighting for DatePicker variants by restructuring Popover.Trigger so the focus ring is applied to the correct element and preventing the inner TextInput from taking focus.
Changes:
- Reworked
Popover.Triggerplacement in DatePicker, DateRangePicker, and DateTimePicker so focus-visible ring classes apply consistently. - Made inner
TextInputnon-focusable (tabIndex={-1}) and prevented mouse-down focus stealing (onMouseDown). - Extended
TextInputprop types to supporttabIndexandonMouseDown.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/frappe-ui-react/src/components/textInput/types.ts | Adds tabIndex and onMouseDown to TextInput types to support new focus-handling behavior. |
| packages/frappe-ui-react/src/components/datePicker/datePicker.tsx | Moves focusable trigger to the correct wrapper and prevents the inner input from taking focus. |
| packages/frappe-ui-react/src/components/datePicker/dateRangePicker.tsx | Applies the same trigger/focus restructuring for the range picker variant. |
| packages/frappe-ui-react/src/components/datePicker/dateTimePicker.tsx | Applies the same trigger/focus restructuring for the date-time picker variant. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
DatePicker, DateRangePicker, and DateTimePicker wrapped the TextInput in a Popover.Trigger whose render prop pointed at the inner TextInput. Because the focusable/interactive element was the input itself, the focus-visible ring on Popover.Trigger never rendered where expected.
Fix
Screenshot/Screencast
Before:

After:

Checklist