Journal Link to task: select the prefilled title on focus so typing replaces it

Chiusa Adatta ai principianti
#480 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #483 di @nevridge — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Leggi TaskTypeahead.tsx, i relativi test e docs/FRONTEND.md intorno alla riga 250. Verifica come handleFocus e handleClick impostano il valore del campo di input e aprono l’elenco dei suggerimenti, quindi aggiungi test per i casi elencati relativi a focus, clic, digitazione, posizione del cursore e nuova selezione. Il lavoro è terminato quando i criteri di accettazione sono soddisfatti e la documentazione descrive il comportamento di selezione; l’issue richiede anche verifiche manuali su iOS Safari e Android Chrome.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Groomed 2026-11-08 — ready for implementation.

Original Description

Problem

In the journal "Link to task" picker (TaskTypeahead), focusing the input on a row that already has a linked task fills the input with the linked task's title (handleFocus calls setInputValue(selectedTitle)) but does not select that text. Typing then appends to the title instead of replacing it, so the filter text is the old title plus the new characters and matches nothing.

This is most visible since #423 added search by task ID: on a linked row, typing 42 gives Old title42, and the task #42 is not found. The behavior itself predates #423. The #478 review and the PR description both flagged it as a follow-up.

Expected

Focusing (or clicking) the input on a linked row selects the prefilled title, so the first keystroke replaces it. The user can still click again to place the caret and edit the title text.

Notes

  • Web only: TaskTypeahead.tsx (handleFocus, handleClick) and its tests.
  • Check keyboard focus (Tab into the input) and click or tap, including mobile, where selecting on focus can raise the selection handles.
  • Related: #423 (search by ID, done, PR #478). No overlap with #464 (task title focus on the details page) or #479 (focus the edited row on return to the Tasks page).

User Story

Scope note: the only consumer of TaskTypeahead is DailyLogSection.tsx (the per-row pickers and the draft picker). TodosSection does not use it, so the original description's references to todo rows mean daily log rows.

As a journal user, I want the existing linked task title to be selected when I focus or click the "Link to task" input on a linked daily log row, so that my first keystroke replaces the title and I can find another task (for example by typing its ID) without deleting the old text first.

Implementation note: whether the select happens in handleFocus, handleClick or both is left to the builder. The behavior is fixed by the acceptance criteria below.

Acceptance Criteria

  1. Given a daily log row linked to a task, when I focus the input with the keyboard (Tab), then the whole prefilled title is selected (selectionStart = 0, selectionEnd = title length) and the suggestion list opens.
  2. Given a linked row whose input is not focused, when I click the input, then the whole title is selected once the click completes. The mouse caret placement must not overwrite the selection.
  3. Given the title is selected, when I type 42, then the input value is 42 and the list is filtered by 42, so task #42 appears.
  4. Given the input is focused and the list is open on a linked row, when I click the input again, then the caret is placed at the click position and the title is not re-selected, so I can edit the title text.
  5. Given I just chose a task (the input keeps focus and the list is closed), when I click the input, then the list reopens and the new title is selected.
  6. Given the title is selected, when I press Backspace, then the filter text is empty and the first 10 tasks are shown. The row stays linked until I choose "None" or another task.
  7. Given a row with no linked task, when I focus or click the input, then behavior is unchanged: the input is empty, the list opens and nothing is selected.
  8. Given the input is focused, when I press Escape, then the existing behavior still applies (the list closes, then onEscape is called or the input blurs). Blur still closes the list after 150ms.
  9. Given the change is implemented, when the test suite runs, then all existing tests pass. New tests cover Tab focus, click focus, typing-replaces, re-click-places-caret and re-select after a selection. The tests assert selectionStart and selectionEnd.
  10. Given the PR is opened, when it is reviewed, then the PR description records a manual check of selection behavior on iOS Safari and Android Chrome, including whether the selection handles are disruptive.
  11. Given the change ships, when I read docs/FRONTEND.md (around line 250), then it states that focusing or clicking a linked row selects the title.

Edge Cases

  • Mouse timing: the browser places the caret on mousedown, after focus. A select() inside handleFocus may be overwritten, so the select may need to be deferred or done on click.
  • Click guard: handleClick returns early when the list is already open. The click that reopens the list after a selection must still select (AC 5), while a click on an open list must not (AC 4).
  • Mobile fallback: select-all applies on all devices, including touch. If the manual checks (AC 10) show the selection handles are disruptive, skip the select on coarse pointers via isCoarsePointer() in lib/pointer.ts, and document that in docs/FRONTEND.md. iOS Safari behavior is currently unverified, and the mobile tests mock the picker.
  • Tab focus: browsers often select all on Tab already. Verify this so the code does not conflict with it.
  • Title changes while focused: a refetch or rename of the linked task while the input is focused could leave the selection stale.
  • Accidental unlink: select-all, then Backspace, then blur does not unlink. This is existing behavior, and "None" remains the only unlink path.

Out of Scope

  • Unlinking a task by clearing the text.
  • Changes to search, filter or ID-search logic (#423).
  • Changes to TodosSection, other text inputs or NotesSection, including their caret-to-end-on-focus code.
  • Changes to keyboard navigation, the 150ms blur timer or programmatic focus.
  • Any API, assistant or generated-client change.
  • Overlap with #464 and #479.
Lingua principale
C#
Stelle
1
Fork
0
Merge medio
2h 28m
PR unite (30g)
107

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nevridge/TaskFlow

Tutte le issue di nevridge/TaskFlow

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.