components icon indicating copy to clipboard operation
components copied to clipboard

[Tabs] tab is not changed when selectedindex changes

Open bkappel opened this issue 8 years ago • 9 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Tab corresponding to the index should be displayed.

What is the current behavior?

Previously selected tab is displayed, tabGroup selectedIndex is not updated.

What are the steps to reproduce?

This bug can also be found in the documentation/demos. Material Demo In the demo "Tag group with dynamically changing tabs" when checking the "Select tab after adding", the tab is not focused when adding a tab. In custom code the tab is also not focused when updating the selectedIndex.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

  • Angular: 6.0.6
  • Angular Material: 6.3.2
  • OS: Windows
  • Browsers: Chrome, FireFox, Opera, IE Edge

Is there anything else we should know?

bkappel avatar Jul 03 '18 13:07 bkappel

+1

vdrasutis avatar Jul 03 '18 14:07 vdrasutis

I'm too facing similar issue for MatStepper module. The selectedIndex property is not updated first click event but always on second one. It's similar to what @robertmesserle explained here https://github.com/angular/material2/issues/687 but for stepper module.

candidJ avatar Jul 08 '18 10:07 candidJ

The ability to select a tab after adding it appears to have been broken by #9132.

dmacfarlane avatar Jul 09 '18 16:07 dmacfarlane

+1 - reverting fixed for me.

develra avatar Jul 12 '18 18:07 develra

This is also a serious bug for our business. Please fix the functionality and the example on your page.

Auricopter avatar Jul 17 '18 10:07 Auricopter

@Auricopter A fix is now pending. Working on getting that in as soon as possible.

devversion avatar Jul 17 '18 11:07 devversion

@DevVersion Thank you. It works now. However I need to add a setTimeout() since the code example on your page doesn't wait for the Tab Creation before changing the selectedIndex. Is there a callback-function or life cycle hook for the Tab Creation?

Auricopter avatar Jul 17 '18 12:07 Auricopter

The fix is not merged and published yet. As soon as it will be part of a future Material release, you wouldn't need the setTimeout at all. Everything happens in the same change detection run

devversion avatar Jul 17 '18 12:07 devversion

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.