Repository navigation
time_field: Focus the first segment when the field is pressed outside a segment - #3655
Merged
Merged
Conversation
… a segment A press on the field's empty space did nothing: only the digit segments listened for the mouse. The base field now fills the styled frame and a press anywhere in it focuses the field and selects the first segment, while a press on a segment still selects that segment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ylinwind
force-pushed
the
time-field-click-blank-focus
branch
from
October 23, 2026 11:12
6636a90 to
043adc3
Compare
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
Pressing a
TimeFieldanywhere outside its digit segments did nothing. Only the segments listened for the mouse, so with a wide field (for example a form field set tow_full) most of its area was dead: a press beside09 : 00neither focused the field nor selected a segment. Segmented date/time inputs such as react-aria'sTimeField(used by shadcn's date picker) focus the first segment when the field itself is pressed.gpui-base: the field root now handles a left press by focusing the field and selecting its first segment. A press on a segment stops propagation after selecting that segment, so it still selects the segment it hit, not the first one. A disabled field does not handle the press, as before.gpui-component: the base field now fills the styled frame (size_full), and the frame's horizontal padding moved onto the base field. The rendered result is the same, but a press anywhere inside the frame now reaches the field.This touches
gpui-basebecause only the base state can select a segment (select_segmentis private), and the press behavior belongs to the base field.Impact
TimeField: the component itself,DatePicker's time row and thegpui-shellretained-formTimeField. All three render the same component, so they all get the new behavior. Pressing a segment works as it did before.DatePickercloses its popup withon_mouse_up_out, which runs in the capture phase and is based on pointer position. The newstop_propagationon segment mouse-down happens in the bubble phase, so closing the popup is not affected. TheDatePickerframe isflex_nonewith no explicit width, sosize_fullon the inner field does not change its size.MouseDownlistener on an ancestor no longer receives presses that land on a segment. No such listener exists in this repository.How to Test
pressing_outside_the_segments_focuses_the_first_segmentpresses the empty part of a 200px field (focused, hour selected), then the minute segment (minute selected), then the empty part again (hour selected). It fails without this change.Also checked in a downstream app (Allsum's scheduled task form): pressing the empty part of a full-width time field selects the hour.
Checklist
cargo runfor story tests related to the changes.🤖 Generated with Claude Code