+
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 6, 2025

🚀 Description

A wild pattern has emerged! We started using the icons pattern in components where:

  • An icon is used more than once in a component.
  • An icon is too large and obscures the markup.

The latter reason is a good one to adopt the pattern wherever we can, I think. Another reason is that it labels icons, which we previously and inconsistently did using code comments.

So I've adopted the pattern throughout. I also deduplicated some icons shared across various components and changed to rem icon widths and heights that were in pixels.

📋 Checklist

🔬 How to Test

  1. Verify that the "x" icon of Input, Inline Alert, Modal, Toast, and Tag matches production.
  2. Verify Accordion, Dropdown, Split Button Secondary Button, Tab Group, and Tree's chevron matches production.
  3. Verify Tree matches production when expanded and when indentation is removed.
  4. Verify Modal's back button and close buttons are announced by VoiceOver.

📸 Images/Videos of Functionality

N/A

Copy link

changeset-bot bot commented Jan 6, 2025

🦋 Changeset detected

Latest commit: fbe27f8

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 Minor

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 6, 2025

/>
</svg>
`,
high: svg`
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 svg template literal is meant for SVG fragments:

The svg tag function should only be used for SVG fragments, or elements that would be contained inside an HTML element. A common error is placing an element in a template tagged with the svg tag function. The element is an HTML element and should be used within a template tagged with the html tag function.

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch 4 times, most recently from f9ea246 to 30fc1e6 Compare January 6, 2025 16:10
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

Used by Input, Inline Alert, Modal, Toast, and Tag.

stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

Used by Accordion, Dropdown, Split Button Secondary Button, Tab Group, and Tree.

},
() => {
return html`<svg
aria-label=${this.#localize.term('open')}
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

Removed aria-label. As far as I can tell, it's not announced by VoiceOver and wouldn't add anything if it were given the presence of aria-expanded. CC: @noahgelmancs.

cursor: not-allowed;
svg {
color: var(--glide-core-text-tertiary-disabled);
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

I styled the SVG from .component so I could remove its dynamic .disabled class and move the icon to icons.

Flattening styles is good. But so consistency via an icons object in each component. What do you think? Is the additional nesting worth the consistency?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no strong opinion from me either way

render(arguments_) {
// A `<span>` is used instead of a `<button>` for VoiceOver, so
// "button" isn't read aloud, implying the target can be interacted
// with via click.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Aha. Now I remember why it was a <span> instead of <button>.


expect([
...component.shadowRoot!.querySelector('.expand-icon')!.classList,
]).to.deep.equal(['expand-icon']);
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

The assertion began failing because I removed this class and styled the SVG from .expand-icon-container. One of my next tasks is to remove tests like these to prepare for VRT. So I removed it instead of fixing it.

${when(
this.hasExpandIcon,
() => html`
<div>
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

It's not obvious what this classless <div> was for—if anything. Any idea @danwenzel?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope, seems like you can safely remove it

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from 30fc1e6 to 4de9dc9 Compare January 6, 2025 16:49
name: '',
orientation: 'horizontal',
pattern: '',
'password-toggle': false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bonus.

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from 4de9dc9 to 2490d5b Compare January 6, 2025 17:06
@clintcs clintcs changed the title Move component icons to icons objects Icons cleanup Jan 6, 2025
@clintcs clintcs changed the title Icons cleanup Move component icons to icons objects Jan 6, 2025
@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from 2490d5b to ec40cde Compare January 6, 2025 17:12
>
<span class="optional-tooltip-target" slot="target" tabindex="0">
<svg
aria-label=${this.#localize.term('moreInformation')}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed aria-label. As far as I can tell, it's not announced by VoiceOver and doesn't add anything given the Tooltip is shown immediately on focus. What do you think, @noahgelmancs?

Choose a reason for hiding this comment

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

@clintcs Good to go 👍

}

const icons = {
information: html`
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

Happy to tweak the name.


close: string;
dismiss: string;
open: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer in use now that it's not used in Dropdown.

dismiss: string;
open: string;
selectAll: string;
moreInformation: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer in use now that it's not used in Label.

>
<style>
[slot="target"] {
background-color: transparent;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer needed now that the <button> is a <span>.

@@ -1,17 +0,0 @@
import { svg } from 'lit/static-html.js';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only used by Inline Alert. So I moved it there.

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from ec40cde to 770f3b8 Compare January 6, 2025 17:24
}
}
.optional-tooltip-target {
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

"- Form control tooltip focus outlines now hug their "ⓘ" icons."

Before

image

After

image

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from 770f3b8 to 3656416 Compare January 6, 2025 17:30
cursor: pointer;
display: flex;
justify-content: center;
rotate: -90deg;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we have a single chevron icon and rotate it as needed? Or should we have an icon for each direction?

Copy link
Collaborator

Choose a reason for hiding this comment

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

A feel like a single chevron should be fine, as long as any aria-labels change accordingly

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch 2 times, most recently from cdbd5b7 to dfc4046 Compare January 6, 2025 18:19
/* "-webkit-scrollbar" is needed for Safari */
&::-webkit-scrollbar {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Safari supports scrollbar-width as of 18.2.

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch 3 times, most recently from 1560733 to b772947 Compare January 6, 2025 18:31
& .overflow {
--size: 1.125rem;
align-items: center;
Copy link
Collaborator Author

@clintcs clintcs Jan 6, 2025

Choose a reason for hiding this comment

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

"- Tab Group's overflow buttons are now vertically centered."

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch 4 times, most recently from c95b8f3 to e19f338 Compare January 6, 2025 18:55
@clintcs clintcs marked this pull request as ready for review January 6, 2025 18:55
cursor: not-allowed;
svg {
color: var(--glide-core-text-tertiary-disabled);
Copy link
Collaborator

Choose a reason for hiding this comment

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

no strong opinion from me either way

cursor: pointer;
display: flex;
justify-content: center;
rotate: -90deg;
Copy link
Collaborator

Choose a reason for hiding this comment

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

A feel like a single chevron should be fine, as long as any aria-labels change accordingly

cursor: pointer;
display: flex;
justify-content: center;
rotate: -90deg;
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@clintcs
Copy link
Collaborator Author

clintcs commented Jan 9, 2025

Pushed an amended commit resolving the conflicts.

@clintcs clintcs force-pushed the move-component-icons-to-icons-object branch from e19f338 to fbe27f8 Compare January 9, 2025 18:28
@clintcs clintcs merged commit 8802391 into main Jan 9, 2025
7 checks passed
@clintcs clintcs deleted the move-component-icons-to-icons-object branch January 9, 2025 19:58
@github-actions github-actions bot mentioned this pull request Jan 9, 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.

4 participants

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