angular / angular/components

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

Open
#17,889 7 comments 13 reactions 0 assignees View on GitHub
area: material/tabs feature P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

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

Contributor guide

Open the contributing guide

Research direction

Start with the MatTab selectedIndex input and selectedTabChange EventEmitter behavior described in the issue. Determine how UI and programmatic changes can be distinguished, then verify that URL-driven changes do not trigger the UI-change notification while user tab changes still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.