components icon indicating copy to clipboard operation
components copied to clipboard

MatTab: selectedTabChange should not fire when the tab is changed programmatically

Open TheParad0X opened this issue 6 years ago • 7 comments

There should be a way to differentiate between a UI and a programmaticcally induced tab change. As of now, both cause the selectedTabChange: EventEmitter to emit.

My case is pretty simple: I want to display the currently opened Tab in the URL:

somePage?openedTab=1 somePage?openedTab=2

But I also want the corresponding tab to open when a URL pointing to a specific tab is navigated to. Ideally, the [selectedIndex] input should not cause (selectedTabChange) to fire.

Does this make sense?

Material 8.2.3, Angular 8.2.11

TheParad0X avatar Dec 06 '19 10:12 TheParad0X

Sounds like a reasonable feature request to me. Native elements (such as input) do not emit on programmatic changes either, so we should definitely match that.

https://stackblitz.com/edit/comp-17889?file=src/app/app.component.html

devversion avatar May 28 '20 09:05 devversion

will this be fixed ? i think is a bug, not a feature request ... especially when an input binding (selectedIndex) change results in firing of both selectedTabChange and selectedIndexChange

https://stackblitz.com/edit/angular-mat-tab-group-outputs?file=src/app/tab-group-basic-example.ts

thanks 👍

gubo avatar Oct 30 '20 22:10 gubo

Any news here?

KlausHans avatar Jan 15 '21 11:01 KlausHans

Interested on an update on this one as well

rbogdy avatar Feb 10 '21 03:02 rbogdy

This obvious flaw is still not fixed, any updates?

haskelcurry avatar Jan 10 '22 08:01 haskelcurry

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] avatar Feb 22 '22 15:02 angular-robot[bot]

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Mar 14 '22 15:03 angular-robot[bot]