material-components / material-components/material-web

md-tabs fires change event when programmatically setting activeTab(Index)

Open
#5,024 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
11.3k
Forks
1.1k
Avg merge
20h 28m
Merged PRs (30d)
13

Description

What is affected?

Component

Description

Just trying to manually set the active tab when I discovered that it fires the change event. Normally not an issue unless my change handler also happens to change the active tab. My understanding was that the change event only fires on user interaction, or at least the docs don't indicate otherwise.

Reproduction

Example Playground

Workaround

I have not found a workaround.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

1.0.0

Browser/OS/Node environment

Browser: Edge 117.0.2045.43
OS: Windows 11 22H2
Node version: 18.18.0
npm version: 10.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Example Playground and reproduce the behavior in the md-tabs component using activeTabIndex and the change handler. Then trace the component's tab-selection and change-event entry points. Done means programmatic active-tab changes no longer trigger the change event, while user interaction remains covered by the relevant existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.