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(expansion): expansion panel breaks when quickly closing panels using keyboard commands #27430

Closed
1 task
wagnermaciel opened this issue Jul 10, 2023 · 2 comments · Fixed by #28646
Closed
1 task
Assignees
Labels
area: material/expansion P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@wagnermaciel
Copy link
Contributor

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

When a mat-expansion-panel has tabbable elements in it's panel content, the mat-expansion-panel will break if a user attempts to quickly close and tab away from a panel after closing (easily reproduced using space + tab)

Reproduction

StackBlitz link: https://stackblitz.com/edit/dgbfpa-3pq8m8?file=src%2Fexample%2Fexpansion-overview-example.html
Steps to reproduce:

  1. Tab to the first expansion panel
  2. Quickly try to close all of the expansion panels using keyboard commands (space + tab)

Expected Behavior

You successfully close the expansion panels

Actual Behavior

The expansion panels are closed but in a broken state

Environment

  • Angular: 16.1.1
  • CDK/Material: 16.1.4
  • Browser: Chrome
  • Operating System: macOs
@wagnermaciel wagnermaciel added needs triage This issue needs to be triaged by the team P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/expansion and removed needs triage This issue needs to be triaged by the team labels Jul 10, 2023
@kharazian
Copy link
Contributor

Hello,

I'd like to know if someone is currently engaged with this task. If not, I'm ready to take a shot at it and work on the solution, pending your consent.

Thank you!

kharazian added a commit to kharazian/components that referenced this issue Aug 19, 2023
…imation

This commit addresses an issue where mat-expansion-panels were breaking when a user attempted to quickly close and tab away from a panel after closing it. The issue occurred because the tab key was being pressed between the collapsing animation, causing the panel body to remain visible and receive focus.

To resolve this, we manually set the panel's visibility to hidden when the tab key is pressed during the collapsing animation. This ensures that the next element in the tab order receives focus as expected.

Fixes angular#27430.
kharazian added a commit to kharazian/components that referenced this issue Sep 27, 2023
This commit addresses an issue where mat-expansion-panels were breaking when a user attempted
to quickly close and tab away from a panel after closing it. The issue occurred because the tab
key was being pressed between the collapsing animation, causing the panel body to remain visible
and receive focus.

To resolve this, we manually set the panel's visibility to hidden when the tab key is pressed
during the collapsing animation. This ensures that the next element in the tab order receives
focus as expected.

Fixes angular#27430.
@crisbeto crisbeto self-assigned this Feb 26, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 26, 2024
…it's animating

Currently the expansion panel prevents focus from entering it using `visibility: hidden`, but that only works when it's closed. This means that if the user tabs into it while it's animating, they may scroll the content make the component look broken.

These changes resolve the issue by setting `inert` on the panel content while it's animating. Also cleans up an old workaround for IE.

Fixes angular#27430.
Fixes angular#28644.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 26, 2024
…it's animating

Currently the expansion panel prevents focus from entering it using `visibility: hidden`, but that only works when it's closed. This means that if the user tabs into it while it's animating, they may scroll the content make the component look broken.

These changes resolve the issue by setting `inert` on the panel content while it's animating. Also cleans up an old workaround for IE.

Fixes angular#27430.
Fixes angular#28644.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 26, 2024
…it's animating

Currently the expansion panel prevents focus from entering it using `visibility: hidden`, but that only works when it's closed. This means that if the user tabs into it while it's animating, they may scroll the content make the component look broken.

These changes resolve the issue by setting `inert` on the panel content while it's animating. Also cleans up an old workaround for IE.

Fixes angular#27430.
Fixes angular#28644.
crisbeto added a commit that referenced this issue Feb 26, 2024
…it's animating (#28646)

Currently the expansion panel prevents focus from entering it using `visibility: hidden`, but that only works when it's closed. This means that if the user tabs into it while it's animating, they may scroll the content make the component look broken.

These changes resolve the issue by setting `inert` on the panel content while it's animating. Also cleans up an old workaround for IE.

Fixes #27430.
Fixes #28644.
crisbeto added a commit that referenced this issue Feb 26, 2024
…it's animating (#28646)

Currently the expansion panel prevents focus from entering it using `visibility: hidden`, but that only works when it's closed. This means that if the user tabs into it while it's animating, they may scroll the content make the component look broken.

These changes resolve the issue by setting `inert` on the panel content while it's animating. Also cleans up an old workaround for IE.

Fixes #27430.
Fixes #28644.

(cherry picked from commit 24eaa2e)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/expansion P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
3 participants