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

Conversation

danwenzel
Copy link
Collaborator

@danwenzel danwenzel commented Jul 25, 2025

🚀 Description

Wraps the Accordion prefix icon slot in a flex container, to prevent slotted SVGs from shrinking at narrow widths.

Before

image

After

image

🔬 How to Test

Copy link

changeset-bot bot commented Jul 25, 2025

🦋 Changeset detected

Latest commit: c8ac5f8

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

@danwenzel danwenzel force-pushed the prevent-accordion-svg-shrinking branch from 1dda109 to a8cbe75 Compare July 25, 2025 15:03
@danwenzel danwenzel marked this pull request as ready for review July 25, 2025 15:13
&.prefix-icon {
.default-slot {
padding-inline-start: 3.25rem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where we can, we try not to style one element via another so that each style declaration for an element is the source of truth for all its styles.

So, instead of styling .default-slot from .component, I'd recommend applying this style directly to .default-slot via a conditional class similar to .indented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@clintcs - Makes sense! So the .prefix-icon-slot class already existed, but wasn't being used for anything. Would you prefer I:

  1. Change the existing .prefix-icon-slot to be conditional, only added if there is a prefix icon
  2. Keep the existing .prefix-icon-slot as-is, and add a conditional .has-prefix-icon class
  3. Remove the existing .prefix-icon-slot, and only have a conditional .has-prefix-icon class
  4. Something else.. :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Check out the comment I just added. Maybe we can skirt making a decision.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Spoke offline: we went with option 2, except changing the name of the new class to .slotted-content

.prefix-icon-slot {
align-items: center;
display: flex;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Am I missing something? Or is this and the padding above just a more indirect way of preventing the prefix icon slot from shrinking?

Suggested change
display: flex;
display: block;
flex-shrink: 0;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The padding above doesn't apply here; that's on the default slot.

But yes, it looks like display: block; works (even without a flex-shrink value)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry about that. What I was getting at with the padding above was I was wondering if my suggested change above is all you need and that you could revert it and the .indentation change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out we do need display: flex; and align-items: center, to ensure that icons are aligned with the label (tested in an application)

The indentation was existing, and I had just moved it to be nested; but I've reverted that change

@danwenzel danwenzel force-pushed the prevent-accordion-svg-shrinking branch from a8cbe75 to c0a38b0 Compare July 25, 2025 16:46
@ynotdraw
Copy link
Collaborator

Thanks for the fix!

Wraps the prefix icon slot in a flex container, to prevent slotted SVGs from shrinking at narrow widths
@danwenzel danwenzel force-pushed the prevent-accordion-svg-shrinking branch from c8ac5f8 to c666416 Compare July 25, 2025 16:56
@clintcs
Copy link
Collaborator

clintcs commented Jul 25, 2025

Thanks for the fix!

Welcome back, Dan! 😆

@danwenzel danwenzel added this pull request to the merge queue Jul 25, 2025
Merged via the queue into main with commit b4859c2 Jul 25, 2025
29 checks passed
@danwenzel danwenzel deleted the prevent-accordion-svg-shrinking branch July 25, 2025 17:12
@github-actions github-actions bot mentioned this pull request Jul 25, 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浏览器服务,不要输入任何密码和下载