Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(material/datepicker): prevent calendar from stealing away focus #31128

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

crisbeto
Copy link
Member

An earlier change added some logic to the calendar to re-focus the active date if an input requiring a full re-render changes which can potentially cause focus to be lost.

The problem with this is that if the calendar is used on its own, it might steal away focus even though the user wasn't interacting with it.

These changes add a check that focus is inside the calendar before attempting to recapture it.

Fixes #30635.

An earlier change added some logic to the calendar to re-focus the active date if an input requiring a full re-render changes which can potentially cause focus to be lost.

The problem with this is that if the calendar is used on its own, it might steal away focus even though the user wasn't interacting with it.

These changes add a check that focus is inside the calendar before attempting to recapture it.

Fixes angular#30635.
@crisbeto crisbeto requested a review from a team as a code owner May 15, 2025 07:10
@crisbeto crisbeto removed the request for review from a team May 15, 2025 07:10
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label May 15, 2025
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed area: material/datepicker labels May 15, 2025
@crisbeto crisbeto merged commit 5397b38 into angular:main May 15, 2025
27 of 29 checks passed
@crisbeto
Copy link
Member Author

The changes were merged into the following branches: main, 19.2.x, 20.0.x

crisbeto added a commit that referenced this pull request May 15, 2025
…31128)

An earlier change added some logic to the calendar to re-focus the active date if an input requiring a full re-render changes which can potentially cause focus to be lost.

The problem with this is that if the calendar is used on its own, it might steal away focus even though the user wasn't interacting with it.

These changes add a check that focus is inside the calendar before attempting to recapture it.

Fixes #30635.

(cherry picked from commit 5397b38)
crisbeto added a commit that referenced this pull request May 15, 2025
…31128)

An earlier change added some logic to the calendar to re-focus the active date if an input requiring a full re-render changes which can potentially cause focus to be lost.

The problem with this is that if the calendar is used on its own, it might steal away focus even though the user wasn't interacting with it.

These changes add a check that focus is inside the calendar before attempting to recapture it.

Fixes #30635.

(cherry picked from commit 5397b38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat/bug(MatCalendar): Allow to turn focus off on change inputs to MatCalendar
2 participants