Skip to content

refactor: open date picker overlay on element focus in fullscreen #9670

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DiegoCardoso
Copy link
Contributor

Description

This change overrides the focus method to change how focus is handled when the element is in fullscreen mode and it's focused. This is needed to avoid the element being immediately removed by the Grid Pro when the user is on a device with small viewport. The element receives focus, but the _onFocus listener has a similar detection, which removes the focus from the input element, which causes the component to be removed from the cell when used as a custom editor.

Part of #9158

Type of change

Refactor

This change overrides the `focus` method to change how focus is handled
when the element is in fullscreen mode and it's focused. This is needed
to avoid the element being immediatelly removed by the Grid Pro when the
user is in a device with small viewport. The element receives focus, but
the `_onFocus` listener has a similar detection which removes the focus
from the input element, which causes the component to be removed from
the cell when used as a custom editor.

Part of #9158
@DiegoCardoso
Copy link
Contributor Author

I was able to refactor the DatePickerObserver class used by the field highlighter to fix the current test failure. But these changes are causing this other test to fail, that I am unsure whether is still relevant or an indication that the changes introduced in this PR might be problematic for the field highlighter.

As this PR prevents the input element from being focused, calling focus on the date picker will behave in the same way as the user clicking on the host element. So, there's no blur at the moment the focus method is called. With the changes I have locally, the vaadin-highlight-show is triggered when the focus is called. So there would be a slight change in behavior for this case.

WDYT, @web-padawan?

@web-padawan
Copy link
Member

But these changes are causing this other test to fail, that I am unsure whether is still relevant

IMO it makes sense to remove that test in this case. The behavior change sounds good to me.

Copy link

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.

2 participants