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

bug(cdk-virtual-scroll-viewport): input lose focus when item is scrolled out of view #30668

Open
1 task
markusrisberg opened this issue Mar 20, 2025 · 0 comments
Labels
needs triage This issue needs to be triaged by the team

Comments

@markusrisberg
Copy link

markusrisberg commented Mar 20, 2025

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

If an item has an element that holds focus, e.g. an <input> element, that element will lose focus once the item is scrolled out of view.

Reproduction

StackBlitz link: https://stackblitz.com/edit/angular-pj7cgqpf?file=app%2Fcdk-virtual-scroll-overview-example.html
Steps to reproduce:

  1. Focus on the input field in the first item
  2. Scroll to bottom
  3. Type "hello"
  4. Scroll to top

Expected Behavior

Input field should say "hello" and it should still have focus.

Actual Behavior

Input field lose focus so text is not saved

Environment

  • Angular: 7.2.16
  • CDK/Material: 7.3.7
  • Browser(s): Chrome 134.0.6998.88
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu
@markusrisberg markusrisberg added the needs triage This issue needs to be triaged by the team label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

1 participant