Skip to content

fix(date-picker): add proper focus highlighting - #326

Closed
PraveenKum11 wants to merge 1 commit into
feat/timesheetfrom
fix/datepicker-highlight
Closed

fix(date-picker): add proper focus highlighting#326
PraveenKum11 wants to merge 1 commit into
feat/timesheetfrom
fix/datepicker-highlight

Conversation

@PraveenKum11

@PraveenKum11 PraveenKum11 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

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

  • Moved Popover.Trigger to wrap the label/input container directly (instead of being deep inside the render render-prop) so the focus-visible:ring-2 focus-visible:ring-outline-gray-3 classes apply to the correct element, in all three components (datePicker.tsx, dateRangePicker.tsx, dateTimePicker.tsx).
  • Set tabIndex={-1} and onMouseDown={(e) => e.preventDefault()} on the inner TextInput so it no longer steals focus/tab order from the trigger — the trigger itself now receives focus and shows the highlight ring.

Screenshot/Screencast

Before:
image

After:
image


Checklist

  • If this PR adds a new component, it has a linked issue that was discussed and approved before I started work.
  • I have thoroughly tested this code to the best of my abilities.
  • I have reviewed the code myself before requesting a review.
  • This code is covered by unit tests to verify that it works as intended.
  • The QA of this PR is done by a member of the QA team (to be checked by QA).

@PraveenKum11
PraveenKum11 requested a balanced review from Copilot August 9, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.Trigger placement in DatePicker, DateRangePicker, and DateTimePicker so focus-visible ring classes apply consistently.
  • Made inner TextInput non-focusable (tabIndex={-1}) and prevented mouse-down focus stealing (onMouseDown).
  • Extended TextInput prop types to support tabIndex and onMouseDown.

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.

Comment thread packages/frappe-ui-react/src/components/datePicker/datePicker.tsx
Comment thread packages/frappe-ui-react/src/components/datePicker/datePicker.tsx
@PraveenKum11
PraveenKum11 requested a review from b1ink0 August 9, 2026 20:06
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.

2 participants