Skip to content

fix(date-time-picker): focus natural language input first when enabled (issue #2046)#2051

Open
ther12k wants to merge 1 commit into
callumalpass:mainfrom
ther12k:fix/issue-2046-nlp-autofocus
Open

fix(date-time-picker): focus natural language input first when enabled (issue #2046)#2051
ther12k wants to merge 1 commit into
callumalpass:mainfrom
ther12k:fix/issue-2046-nlp-autofocus

Conversation

@ther12k

@ther12k ther12k commented Jun 21, 2026

Copy link
Copy Markdown

Summary

When opening the date/time picker from Quick Actions (or any keyboard-driven path), the date input was always receiving initial focus, even when the user had natural language input enabled in settings. This is jarring because the NLP box is the more discoverable entry point when it is rendered.

Changes

  • src/modals/DateTimePickerModal.ts: in onOpen(), prefer naturalLanguageInput.focus() when canUseNaturalLanguageInput() returns true and the element has been rendered. Fall back to the existing dateInput.focus() behavior otherwise, preserving the previous UX for users with NLP disabled.

Tests

Adds tests/unit/issues/issue-2046-nlp-input-autofocus.test.ts covering three cases:

  • NLP enabled → NLP input receives focus, date input does not
  • NLP disabled → date input receives focus, NLP input not rendered
  • Defensive: NLP enabled but ref missing → date input still receives focus (no throw)

All three pass. npx tsc -noEmit --skipLibCheck clean. jest tests/unit/issues all pass.

Verification

npm install
node generate-release-notes-import.mjs
npx tsc -noEmit --skipLibCheck
npx jest tests/unit/issues/issue-2046-nlp-input-autofocus.test.ts --no-coverage

Closes

Fixes #2046

…d (issue callumalpass#2046)

When opening the date/time picker from Quick Actions (or any keyboard-driven
path), the date input was always receiving initial focus, even when the user
had natural language input enabled in settings. This was jarring because the
NLP box is the more discoverable entry point when it is rendered.

Fix: in DateTimePickerModal.onOpen(), prefer naturalLanguageInput.focus()
when canUseNaturalLanguageInput() returns true and the element has been
rendered. Fall back to the existing dateInput.focus() behavior otherwise,
preserving the previous UX for users with NLP disabled.

Adds tests/unit/issues/issue-2046-nlp-input-autofocus.test.ts covering:
  - NLP enabled → NLP input receives focus, date input does not
  - NLP disabled → date input receives focus, NLP input not rendered
  - Defensive: NLP enabled but ref missing → date input still receives focus

Closes callumalpass#2046
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.

[Bug]: Quick Actions for Task Under Cursor "Set due date" autofocuses incorrectly

1 participant