-
Notifications
You must be signed in to change notification settings - Fork 7
Move component icons to icons
objects
#582
Conversation
🦋 Changeset detectedLatest commit: fbe27f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
/> | ||
</svg> | ||
`, | ||
high: svg` |
There was a problem hiding this comment.
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.
f9ea246
to
30fc1e6
Compare
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
</svg> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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')} |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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']); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
30fc1e6
to
4de9dc9
Compare
name: '', | ||
orientation: 'horizontal', | ||
pattern: '', | ||
'password-toggle': false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus.
4de9dc9
to
2490d5b
Compare
2490d5b
to
ec40cde
Compare
> | ||
<span class="optional-tooltip-target" slot="target" tabindex="0"> | ||
<svg | ||
aria-label=${this.#localize.term('moreInformation')} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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.
ec40cde
to
770f3b8
Compare
} | ||
} | ||
.optional-tooltip-target { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
770f3b8
to
3656416
Compare
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
rotate: -90deg; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
cdbd5b7
to
dfc4046
Compare
/* "-webkit-scrollbar" is needed for Safari */ | ||
&::-webkit-scrollbar { |
There was a problem hiding this comment.
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.
1560733
to
b772947
Compare
& .overflow { | ||
--size: 1.125rem; | ||
align-items: center; |
There was a problem hiding this comment.
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."
c95b8f3
to
e19f338
Compare
cursor: not-allowed; | ||
svg { | ||
color: var(--glide-core-text-tertiary-disabled); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Pushed an amended commit resolving the conflicts. |
e19f338
to
fbe27f8
Compare
🚀 Description
A wild pattern has emerged! We started using the
icons
pattern in components where: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
📸 Images/Videos of Functionality
N/A