Skip to content

fix(ui5-calendar): set timestamp of daypicker on mousedown#13527

Open
hinzzx wants to merge 5 commits into
mainfrom
dp-foc-on-mousedown
Open

fix(ui5-calendar): set timestamp of daypicker on mousedown#13527
hinzzx wants to merge 5 commits into
mainfrom
dp-foc-on-mousedown

Conversation

@hinzzx
Copy link
Copy Markdown
Contributor

@hinzzx hinzzx commented May 15, 2026

Overview

Clicking a day in ui5-calendar / ui5-date-picker could move focus to the wrong day.

The root cause

_safelySetTimestamp (which determines the focused date) was only called during the click event, but onAfterRendering fires a focus() call triggered by the preceding mousedown, before click - so focus landed on the previously focused day instead of the clicked one.

What We Did

  • In the day picker, that is a composite component of the calendar, we now set the timestamp on mousedown

What This Fixes

  • Clicking a day now moves focus to that day immediately, even when onAfterRendering fires focus() before the click event resolves

Fixes: #12914

@hinzzx hinzzx requested review from GDamyanov and nnaydenow May 15, 2026 07:48
@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

ui5-webcomponents-bot commented May 15, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 15, 2026 07:54 Inactive
Copy link
Copy Markdown
Contributor

@GDamyanov GDamyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add test?

Comment thread packages/main/src/DayPicker.ts
@nnaydenow
Copy link
Copy Markdown
Contributor

Screen.Recording.2026-05-15.at.10.59.46.mov

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 19, 2026 06:06 Inactive
@hinzzx hinzzx force-pushed the dp-foc-on-mousedown branch from 5cfcec3 to fc16088 Compare May 21, 2026 06:35
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 21, 2026 06:42 Inactive
@hinzzx
Copy link
Copy Markdown
Contributor Author

hinzzx commented May 21, 2026

Screen.Recording.2026-05-15.at.10.59.46.mov

Fixed.

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 21, 2026 08:01 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 21, 2026 08:46 Inactive
Copy link
Copy Markdown
Contributor

@GDamyanov GDamyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 21, 2026 09:01 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 22, 2026 07:04 Inactive
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.

[ui5-calendar]: component move focus

4 participants