Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[date-picker] Date elements are not scrolled into view when navigating within the same month #4037

Closed
mlopezFC opened this issue Jun 10, 2022 · 5 comments
Assignees
Labels
BFP Bug fix prioritised by a customer bug Something isn't working Impact: Low Severity: Minor

Comments

@mlopezFC
Copy link

mlopezFC commented Jun 10, 2022

Description

Moving the focus ring in a date picker in Vaadin 14 makes it to disappear if the date picker is small enough. A similar issue was fixed apparently only in Vaadin 23, but it behaves differently in Vaadin 14:

In Vaadin 23 it works fine (recorded from the docs): UPD: #4037 (comment)

dp-v23

As you can see the date picker is correctly auto scrolled to the focused date.

In Vaadin 14 the focused ring gets lost (also recorded from the docs):

dp-v14

As you can see the focus ring gets hidden.

Expected outcome

In Vaadin 14 it should behave in the same way as in Vaadin 23, where the focus ring is never hidden.

Minimal reproducible example

DatePicker datePicker = new DatePicker("Start date");
add(datePicker);

Steps to reproduce

Just put a DatePicker in a page, and resize the browser as little as possible so you can reproduce the issue as seen in the attached videos.

Environment

Vaadin version(s): 14

Browsers

Issue is not browser related

@web-padawan
Copy link
Member

The fix was backported to Vaadin 14 by vaadin/vaadin-date-picker#799 and released in 14.8.11
I can confirm the issue is not fully fixed, and can be still reproduced in the docs for V14.

@web-padawan web-padawan added bug Something isn't working Severity: Minor Impact: Low V14 only Issue is only valid for Vaadin 14 labels Jun 13, 2022
@vursen
Copy link
Contributor

vursen commented Jun 14, 2022

Vaadin 23 is actually not without this flaw too but there it is mitigated by the fact that the browser appears to scroll the element receiving native focus into view which is not the case for Vaadin 14 where dates are not natively focusable.

In Vaadin 23, the default browser behavior sometimes clashes with the revealDate logic which leads to unexpected scroll jumps, see the video:

Screen.Recording.2022-06-14.at.10.38.07.mov

So what could I suggest?

1. Disable the browser auto scroll on Tab (only relevant for Vaadin 23). UPD: #4037 (comment)
2. Reimplement the revealDate() method so that it would actually scroll the provided date into view rather than just scrolling the month of that date into view (relevant for both versions).

(2) sounds like a challenge though because you first need to smoothly scroll the month into view and then smoothly scroll to the actual date. Perhaps, there is a way to calculate an optimal scroller position with the date in mind before any scrolling begins.

@web-padawan
Copy link
Member

In Vaadin 23, the default browser behavior sometimes clashes with the revealDate logic

Let's investigate if we can fix this, it looks pretty annoying. Maybe it's worth creating a separate issue?

@vursen
Copy link
Contributor

vursen commented Jun 14, 2022

Well, now I think that (2) should be enough to get the issue fixed in both versions. If the date element was correctly scrolled into view by revealDate(), then the browser wouldn't need to scroll anything additionally.

@vursen vursen changed the title The focus-ring on the focused day is getting hidden while pressing Arrow Down in DatePicker in Vaadin 14 [date-picker] The date element is not scrolled into view when navigating within the same month Jun 14, 2022
@vursen vursen changed the title [date-picker] The date element is not scrolled into view when navigating within the same month [date-picker] Date elements are not scrolled into view when navigating within the same month Jun 14, 2022
@vursen vursen removed the V14 only Issue is only valid for Vaadin 14 label Jun 14, 2022
@yuriy-fix yuriy-fix added the BFP Bug fix prioritised by a customer label Oct 11, 2022
@sissbruecker sissbruecker self-assigned this Oct 11, 2022
@web-padawan
Copy link
Member

Fixed by #4759 and vaadin/vaadin-date-picker#809 (for Vaadin 14).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFP Bug fix prioritised by a customer bug Something isn't working Impact: Low Severity: Minor
Projects
None yet
Development

No branches or pull requests

5 participants