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(Mat-Tab): Clicking a half-visible tab doesn't work with non-default animationDuration #21898

Closed
LanderBeeuwsaert opened this issue Feb 13, 2021 · 5 comments · Fixed by #21911
Closed
Assignees
Labels
area: material/tabs has pr P3

Comments

@LanderBeeuwsaert
Copy link

@LanderBeeuwsaert LanderBeeuwsaert commented Feb 13, 2021

Reproduction

See the video in attachment

Steps to reproduce:

  1. setup a mat-tab with:
    { provide: MAT_TABS_CONFIG, useValue: { animationDuration: 1 } }
  2. click a tab that is only half-visible.

Expected Behavior

Tab should jump into view AND become selected.

Actual Behavior

The tab jumps into view, BUT it doesn't become selected.

Environment

@LanderBeeuwsaert LanderBeeuwsaert added the needs triage label Feb 13, 2021
@crisbeto
Copy link

@crisbeto crisbeto commented Feb 15, 2021

I can sort of see it happening here: https://stackblitz.com/edit/angular-9sk3pv?file=src/app/tab-group-dynamic-example.ts. What I think is happening is that the we start scrolling the header on focus which is around the same time as mousedown. Since the element is being moved out from under the pointer before the click is finished, it sometimes gets interruped.

@crisbeto crisbeto added area: material/tabs P3 and removed needs triage labels Feb 15, 2021
@LanderBeeuwsaert
Copy link
Author

@LanderBeeuwsaert LanderBeeuwsaert commented Feb 15, 2021

weird, if I try the stackblitz, the animation has the default duration

@crisbeto
Copy link

@crisbeto crisbeto commented Feb 15, 2021

animationDuration only affects the animation of the content, not the one in the header.

@crisbeto crisbeto self-assigned this Feb 15, 2021
@crisbeto crisbeto added the has pr label Feb 15, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 15, 2021
… header

When a header is scrollable, we scroll a tab into view whenever it receives focus. The
problem is that if focus is moved as a result of a mouse/touch event, the tab can be
moved out from under the pointer, interrupting the click.

These changes work around the issue by not scrolling the header on mouse/touch focus.

Fixes angular#21898.
@LanderBeeuwsaert
Copy link
Author

@LanderBeeuwsaert LanderBeeuwsaert commented Feb 15, 2021

ah, well, we use it in combination with NoopAnimationsModule instead of BrowserAnimationsModule.
If I add that to the stackblitz I reproduce the issue we have:
https://stackblitz.com/edit/angular-9sk3pv-px8i8g?file=src%2Fmain.ts

crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 6, 2021
… header

When a header is scrollable, we scroll a tab into view whenever it receives focus. The
problem is that if focus is moved as a result of a mouse/touch event, the tab can be
moved out from under the pointer, interrupting the click.

These changes work around the issue by not scrolling the header on mouse/touch focus.

Fixes angular#21898.
mmalerba pushed a commit that referenced this issue Jul 27, 2021
… header (#21911)

When a header is scrollable, we scroll a tab into view whenever it receives focus. The
problem is that if focus is moved as a result of a mouse/touch event, the tab can be
moved out from under the pointer, interrupting the click.

These changes work around the issue by not scrolling the header on mouse/touch focus.

Fixes #21898.

(cherry picked from commit 4279ff1)
mmalerba pushed a commit that referenced this issue Jul 27, 2021
… header (#21911)

When a header is scrollable, we scroll a tab into view whenever it receives focus. The
problem is that if focus is moved as a result of a mouse/touch event, the tab can be
moved out from under the pointer, interrupting the click.

These changes work around the issue by not scrolling the header on mouse/touch focus.

Fixes #21898.
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Aug 27, 2021

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 Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/tabs has pr P3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants