Repository navigation
fix(Tokenizer): place the caret after the last token - #7922
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
The caret fix works: with tokens and an empty query, the focused Tokenizer and PowerSearch caret now sits right after the last token on its row, in LTR and RTL. Approval waits on an engineering owner of the input-fields contract deciding whether the idle Spinner slot this branch carries from #7375 (about 22px held on every token row at rest, so a search never moves rows) is the reserve FR1 and FR7 call for, or the unexplained space FR2 rules out. Separately, please reword the caret changeset: when the last row has between 9px and about 44px left, the first keystroke wraps the text to a new row, so the cursor is not always where typed text starts.
[Automated review]
There was a problem hiding this comment.
The caret fix works: with tokens and an empty query, the focused Tokenizer and PowerSearch caret now sits right after the last token on its row, in LTR and RTL, and the reworded changeset matches what happens. Approval still waits on an engineering owner of the input-fields contract deciding whether the idle Spinner slot carried from #7375 (about 22px held on every token row at rest, so a search never moves rows) is the reserve FR1 and FR7 call for or the unexplained space FR2 rules out. Separately, please keep a read-only input from taking the caret's room: on the Disabled With Message story with under 9px left after the last token, Tab now grows the field a blank row (32px to 55px), because the no-room rule in inputCompact keys on :not(:focus) alone. The red pr-a11y job runs a spec that main gained after this branch's merge base, so it should clear on a rebase.
[Automated review]
baec318 to
7a52427
Compare
There was a problem hiding this comment.
The caret fix works: with tokens and an empty query, the focused Tokenizer and PowerSearch caret now sits right after the last token on its row, in LTR and RTL, and a disabled field with a disabledMessage now keeps its height under keyboard focus. Approval still waits on an engineering owner of the input-fields contract deciding whether the idle Spinner slot carried from #7375 (22px held on every token row at rest, so a search never moves rows) is the reserve FR1 and FR7 call for, or the unexplained space FR2 rules out. Nothing else is needed in the code on this branch; if that decision changes #7375, re-carry its new version here. Please also refresh the description, which still lists six carried commits and says only the blurred state drops its inset.
[Automated review]
An empty query's input was an absolutely positioned, end-aligned overlay on the first token row, so the caret blinked at the far end of the first row, even when the tokens wrapped below it. The input now follows the last token in flow, so the caret sits where typed text will start. Blurred, the empty input claims no room, so a full row never grows a blank one; focused, it claims only its text inset and starts a new row when the last one has no room for the caret.
A disabled field with a disabledMessage stays focusable but read-only. Keyed on focus alone, the empty input claimed the caret's inset when such a field was focused, so with less than that left on the last row, Tab grew the field a blank row where nothing can be typed. The no-room rule now also holds while the input is read-only.
7a52427 to
b93fff8
Compare
…g tokens and blank rows (#8249) Add two PowerSearch stories whose play functions the story play guard now runs in Chromium: - Default filters beside the search input (and its RTL twin): filter tokens that reach past the field's center must not overlap the search input, and its center must hit-test as the input and focus it on press. - Token row when resting styles win: for each resting declaration of the empty search input that an empty-query rule overrides, force the resting value to win (as an app's own unlayered StyleX output does when it emits the same atomic class) and require the input to stay on the token row with no change in field height. Both fail on the layout before #7922, where the empty input was an absolutely positioned overlay under the tokens, and pass on main.
User impact
Anyone who focuses a Tokenizer or a PowerSearch that already has tokens. With an empty query, the text cursor blinks at the far end of the first row. Once tokens wrap, that is a different row from the last token, and in a filled first row it lands on top of a token. People expect the cursor where the next token goes: right after the last one.
Problem and solution fit
#6057 took the empty input out of flow so its 40px minimum editing width could not wrap onto a blank row by itself. This keeps that guarantee in flow instead. The input follows the last token, and while the query is empty it asks only for what it needs:
disabledMessagestays focusable): no room at all (no inset, and a negative margin cancels the column gap), so a full row never grows a blank one. This is fix(Tokenizer): avoid blank trailing input row #6057's guarantee.Expected behavior and authority
component:Tokenizer(current), representative state "One or many tokens": "The same input remains after tokens and moves with wrapping."family:input-fields(current), FR2: the caret must not paint or take pointer input under an end control. With fix(Tokenizer): wrap tokens before the clear-all lane #7375 the wrapper reserves the end lane on every row, so the in-flow input stops 3px short of the lane, as the tokens do.Smallest restoration
Everything is in Tokenizer's compact input style. The overlay's absolute position, insets, width calculation, end alignment and per-size vertical centering go away. The empty state becomes a growing flex item with no basis, and only the blurred or read-only state drops its inset and cancels the gap. The focused empty input fills the rest of its row, so the space after the last token is still a direct click target. No prop, type, theme target or token changes.
Two width bands are left, both where the last row has almost no room:
Evidence
Real Chromium, Storybook, 2× scale.
disabledMessagestays focusable, but read-only. Before the last commit, with 3px left on the last row, Tab grew Disabled With Message from 32px to 55px, adding a blank row where nothing can be typed (Tokenizer and PowerSearch, LTR and RTL). It now stays 32px, and the disabled-reason tooltip still appears.maxEntriesor collapsed by an overflow mode, and the typed state keep their styles. fix(Tokenizer): wrap tokens before the clear-all lane #7375's 22 end-lane Chromium cases and the Token remove-target contract pass on top of this change.Preview: Caret placement (RTL) and PowerSearch Many Filters. Click into a field to see the caret.
Not verified: Safari and Firefox.
Scope
Testing
pnpm vitest run packages/core/src/Tokenizer packages/core/src/PowerSearch packages/core/src/Typeahead packages/core/src/__tests__/BusyOwnerAnnouncement.test.tsx: 16 files, 583 tests pass.pnpm -F @astryxdesign/core typecheck; strict ESLint and Prettier on the changed files;pnpm check:changesets,check:syncandcheck:repo.TokenizerEndLaneandTokenRemoveTargetChromium specs againstpnpm storybook:build: all pass.pnpm storybook:build.