fix(date-time-picker): focus natural language input first when enabled (issue #2046)#2051
Open
ther12k wants to merge 1 commit into
Open
fix(date-time-picker): focus natural language input first when enabled (issue #2046)#2051ther12k wants to merge 1 commit into
ther12k wants to merge 1 commit into
Conversation
…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
This was referenced Jun 21, 2026
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.
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: inonOpen(), prefernaturalLanguageInput.focus()whencanUseNaturalLanguageInput()returns true and the element has been rendered. Fall back to the existingdateInput.focus()behavior otherwise, preserving the previous UX for users with NLP disabled.Tests
Adds
tests/unit/issues/issue-2046-nlp-input-autofocus.test.tscovering three cases:All three pass.
npx tsc -noEmit --skipLibCheckclean.jest tests/unit/issuesall pass.Verification
Closes
Fixes #2046