+
Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Conversation

clintcs
Copy link
Collaborator

@clintcs clintcs commented Jan 7, 2025

🚀 Description

From #587:

For consistency, I'll also add a "toggle" event to other components that have an open attribute. I know of at least one case where a consumer has a need for "toggle" event on Dropdown.

📋 Checklist

🔬 How to Test

  1. Navigate to each compoennt in Storybook.
  2. Verify the "toggle" event in the Actions tab.
  3. Verify that Storybook's controls table looks good.

📸 Images/Videos of Functionality

N/A

Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: 9a60323

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@crowdstrike/glide-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jan 7, 2025

@clintcs clintcs force-pushed the add-toggle-event-to-popover branch 3 times, most recently from 88db43e to 95d5c61 Compare January 7, 2025 22:43
@clintcs clintcs changed the title Add "toggle" event to Popover Add "toggle" event to Dropdown, Popover, Menu, and Tooltip Jan 7, 2025
@clintcs clintcs force-pushed the add-toggle-event-to-popover branch 2 times, most recently from 614ea01 to 7645777 Compare January 8, 2025 14:15
---

- Dropdown, Menu, Popover, Split Button, and Tooltip now dispatch a "toggle" event when opened and closed.
- Accordion's "toggle" event is now composed.
Copy link
Collaborator Author

@clintcs clintcs Jan 9, 2025

Choose a reason for hiding this comment

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

I discovered while working on this that Split Button's "toggle" event wasn't in the Actions tab. The reason was that it comes from Menu, and Menu's "toggle" event wasn't composed.

So I figured that was a decent reason to diverge from native and make it composed. I updated Accordion to match.

Copy link
Collaborator Author

@clintcs clintcs Jan 9, 2025

Choose a reason for hiding this comment

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

The only remaining event of ours that's not composed is "change". Native doesn't compose it for historical reasons.

But it's always felt awkward to me that we dispatch both "change" and "input" events—yet only "input" traverses shadow roots. I wonder if it's not time to compose "change" as well as a followup.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it's not time to compose "change" as well as a followup.

You have my vote

@clintcs clintcs force-pushed the add-toggle-event-to-popover branch from 7645777 to 2e0d8a7 Compare January 9, 2025 21:51
expect(event.bubbles).to.be.true;
});

it('does not allow "toggle" to propagate', async () => {
Copy link
Collaborator Author

@clintcs clintcs Jan 9, 2025

Choose a reason for hiding this comment

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

Left a comment explaining why.

@clintcs clintcs force-pushed the add-toggle-event-to-popover branch 4 times, most recently from 3f47c41 to 6e314fb Compare January 9, 2025 22:03
@clintcs clintcs marked this pull request as ready for review January 9, 2025 22:05
@clintcs clintcs force-pushed the add-toggle-event-to-popover branch from 6e314fb to 9a60323 Compare January 9, 2025 22:07
---

- Dropdown, Menu, Popover, Split Button, and Tooltip now dispatch a "toggle" event when opened and closed.
- Accordion's "toggle" event is now composed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it's not time to compose "change" as well as a followup.

You have my vote

@clintcs clintcs mentioned this pull request Jan 10, 2025
@clintcs clintcs merged commit 0b8a7ae into main Jan 10, 2025
7 checks passed
@clintcs clintcs deleted the add-toggle-event-to-popover branch January 10, 2025 16:13
@github-actions github-actions bot mentioned this pull request Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载