+
Skip to content

Conversation

ynotdraw
Copy link
Collaborator

🚀 Description

Adds a Spinner component to Button via the loading attribute.

📋 Checklist

  • I have followed the Contributing Guidelines.
  • I have added tests to cover new or updated functionality.
  • I have added or updated Storybook stories.
  • I have localized new strings.
  • I have followed the ARIA Authoring Practices Guide or met with the Accessibility Team.
  • I have included a changeset.
  • I have scheduled a design review.
  • I have reviewed the Storybook and Visual Test Report links below.

🔬 Manual Testing

  1. Go to Button's story
  2. Toggle the loading attribute
  3. Cycle through the different variants - they should all support loading

@ynotdraw ynotdraw self-assigned this Sep 11, 2025
Copy link

changeset-bot bot commented Sep 11, 2025

🦋 Changeset detected

Latest commit: 2fe3e17

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

@ynotdraw ynotdraw force-pushed the add-loading-to-button branch from c87236c to 9f9053c Compare September 11, 2025 17:30
Comment on lines -10 to +14
() => html`<glide-core-button
label="Label"
aria-description="Description"
></glide-core-button>`,
() =>
html`<glide-core-button
label="Label"
aria-description="Description"
></glide-core-button>`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Linter made me do it.

`);
});

test('loading', { tag: '@accessibility' }, async ({ page }) => {
Copy link
Collaborator Author

@ynotdraw ynotdraw Sep 11, 2025

Choose a reason for hiding this comment

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

loading=${true} would also work, but we don't need to test loading=${false}, as it's redundant with disabled=${false} above.

Did the same for the visual tests. It's probably not ideal, but it beats running an almost identical visual test for every variant with both themes and for every story.

@ynotdraw ynotdraw force-pushed the add-loading-to-button branch from 9f9053c to ac18cd6 Compare September 11, 2025 17:40
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With the addition of loading, it complicated our visual tests quite a bit, as I wanted to test each variant when loading. The existing tests had variant tests mixed in across different states. And while I could have added a describe() block and then tested each variant in there, I also wanted to ensure the focus and hover states when loading were correct. So that complicated things quite a bit.

What I ended up doing here is looping over each Button variant, as you can see starting on line 10. I then had to move things around a bit to ensure we maintain the existing coverage, while also including the loading additions.

This way, we can test each variant and other potential visual states - whether it's attributes, focus states, hover states, or anything else. I think this will serve us well from now on.

The diff is gnarly, so it may be best to view the file directly instead.

@ynotdraw ynotdraw marked this pull request as ready for review September 11, 2025 17:52
'@crowdstrike/glide-core': patch
---

Button now supports a `loading` attribute that will render a Spinner.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth mentioning that loading will also prevent click events?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or maybe, more generally, that loading effectively disables Button.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

eh?

2fe3e17

@ynotdraw ynotdraw force-pushed the add-loading-to-button branch from 33efb64 to 2fe3e17 Compare September 11, 2025 19:21
@ynotdraw ynotdraw added this pull request to the merge queue Sep 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 11, 2025
@ynotdraw ynotdraw added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit 4bd6537 Sep 11, 2025
22 checks passed
@ynotdraw ynotdraw deleted the add-loading-to-button branch September 11, 2025 23:54
@github-actions github-actions bot mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

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