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

feat(mat-datepicker): Allow mat-datepicker to be always visible #29301

Open
angelaki opened this issue Jun 22, 2024 · 2 comments
Open

feat(mat-datepicker): Allow mat-datepicker to be always visible #29301

angelaki opened this issue Jun 22, 2024 · 2 comments
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team

Comments

@angelaki
Copy link

Feature Description

Right now the datepicker shows only up on clicking the toggle button (or implementing some own logic). I'd love the picker to always show up if the bound control is focused.

I've tried to achieve this using a custom directive, but there are so many caveats. I'd like the focus to stay in the input and tabbing away to close it. But using the blur event doesn't work since selecting a date blurs the control, too.

Use Case

I want to make users aware of the possibility to just pick a date while keeping the comfort of filling a form by keyboard / tab only.

@angelaki angelaki added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Jun 22, 2024
@crisbeto
Copy link
Member

crisbeto commented Jun 24, 2024

Right now the datepicker shows only up on clicking the toggle button (or implementing some own logic). I'd love the picker to always show up if the bound control is focused.

This should be possible already by calling the open method in the focus handler.

I've tried to achieve this using a custom directive, but there are so many caveats. I'd like the focus to stay in the input and tabbing away to close it. But using the blur event doesn't work since selecting a date blurs the control, too.

Do you mean opening the calendar while still keeping focus in the input, or using a datepicker input without a calendar? The former would break the accessibility of the datepicker since the user wouldn't know that the popup is there.

@angelaki
Copy link
Author

Using the open method in focus moves the focus to the picker. So the user won't be able to just enter a date by keyboard. And yes, moving the focus back to the input works but breaks the accessibility a bit - just to name one of the caveats.

I want the picker to show up if the input is focused. No overlay, nothing. Just the option / hint to be able to pick a date with the mouse or keep on entering by keyboard and tabbing to the next input control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants