-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 Tabs): focusChange event does not fire when selecting first tab #20374
Labels
area: material/tabs
good first issue
This issue is a good place to start for first time contributors to the project
help wanted
The team would appreciate a PR from the community to address this issue
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Comments
workcomped
changed the title
bug(Mat Tabs): focusChange event does not fire when selecting first tab if initial selectedIndex is not 0
bug(Mat Tabs): focusChange event does not fire when selecting first tab
Aug 20, 2020
jelbourn
added
area: material/tabs
good first issue
This issue is a good place to start for first time contributors to the project
help wanted
The team would appreciate a PR from the community to address this issue
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
and removed
needs triage
This issue needs to be triaged by the team
labels
Aug 20, 2020
Confirmed that this is happening. I think this should be relatively simple to fix. |
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Aug 21, 2020
We were always defaulting the `focusIndex` to 0 on init, rather than taking the index of the selected tab. We actually had tests for this behavior, but they were all testing against 0 so we never caught the issue. Fixes angular#20374.
wagnermaciel
pushed a commit
that referenced
this issue
Sep 16, 2020
We were always defaulting the `focusIndex` to 0 on init, rather than taking the index of the selected tab. We actually had tests for this behavior, but they were all testing against 0 so we never caught the issue. Fixes #20374.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
wagnermaciel
pushed a commit
to wagnermaciel/components
that referenced
this issue
Jan 14, 2021
…ar#20384) We were always defaulting the `focusIndex` to 0 on init, rather than taking the index of the selected tab. We actually had tests for this behavior, but they were all testing against 0 so we never caught the issue. Fixes angular#20374.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: material/tabs
good first issue
This issue is a good place to start for first time contributors to the project
help wanted
The team would appreciate a PR from the community to address this issue
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Reproduction
https://stackblitz.com/edit/angular-yrahxe?file=src%2Fapp%2Ftab-group-basic-example.html
Steps to reproduce:
Expected Behavior
focusChange event should fire when a tab is changed regardless of initially selected tab (index) as a focus change occurred.
Actual Behavior
focusChange event does not fire if first tab is selected as internally it seems to assume the focus is on the first tab. For example, start on selectedIndex = 1 and clicking second tab will fire the event.
Potential Cause & Fix
It seems that in paginated-tab-header.ts, on initialization the initially active item is always 0. Since we should have access to the selectedIndex by this point, setting the following may address this problem.
this._keyManager.updateActiveItem(this._selectedIndex);
Environment
The text was updated successfully, but these errors were encountered: