Skip to content
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

fix(tab-nav): emit calciteTabChange event only when selected tab changes #11812

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

anveshmekala
Copy link
Contributor

@anveshmekala anveshmekala commented Mar 26, 2025

Related Issue: #9792

Summary

No longer emits calciteTabChange event when selected tab is activated again via mouse or keyboard.

@anveshmekala anveshmekala changed the title fix(tab-nav): emit calciteTabChange event only when selected tab changes fix(tab-nav): emit calciteTabChange event only when selected tab changes Mar 26, 2025
@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Mar 26, 2025
@anveshmekala anveshmekala added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 26, 2025
@anveshmekala anveshmekala marked this pull request as ready for review March 26, 2025 21:03
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, @anveshmekala! 😎

@@ -37,7 +37,6 @@ describe("calcite-tab-nav", () => {
const activeEventSpy = await page.spyOnEvent("calciteTabChange");
const firstTabTitle = await page.find("calcite-tab-title");

firstTabTitle.setProperty("selected", true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need this to ensure it doesn’t emit when selecting tab titles programmatically, right?

@@ -1,6 +1,7 @@
export interface TabChangeEventDetail {
/** The tab ID that just became selected */
tab: number | string;
isUserTriggered?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: userTriggered?

@@ -47,7 +46,7 @@ describe("calcite-tab-nav", () => {

await page.keyboard.press("Enter");
await page.waitForChanges();
expect(activeEventSpy).toHaveReceivedEventTimes(2);
expect(activeEventSpy).toHaveReceivedEventTimes(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the test to cover emitting for both keyboard and mouse interactions? The current version won’t fail if one of the two interactions stops emitting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants