-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Expandable component style refactor #3128
chore: Expandable component style refactor #3128
Conversation
Explicit ARIA role is unnecessary when roles are implied from Element. If Element is button, then set aria-label string to altText, else aria-label is undefined. Consumers can pass ARIA role and aria-label through props if using Avatar in an informative way.
Replaced <Box> with <Element> to remove 'as' prop and simplify code.
…4-expandable-style-refactor
…4-expandable-style-refactor
Workday/canvas-kit
|
Project |
Workday/canvas-kit
|
Branch Review |
william-issue-2954-expandable-style-refactor
|
Run status |
|
Run duration | 02m 54s |
Commit |
|
Committer | William Stanton |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
1
|
|
21
|
|
0
|
|
936
|
View all changes introduced in this branch ↗︎ |
UI Coverage
21.29%
|
|
---|---|
|
1525
|
|
410
|
Accessibility
99.28%
|
|
---|---|
|
6 critical
5 serious
0 moderate
2 minor
|
|
98
|
Accepting code suggestion. Co-authored-by: Josh <[email protected]>
Fixing a bug in avatarStencil where the URL image loader wasn't working.
…//github.com/williamjstanton/canvas-kit into william-issue-2954-expandable-style-refactor
@@ -271,8 +271,7 @@ export const Avatar = createComponent('button')({ | |||
return ( | |||
<Element | |||
ref={ref} | |||
aria-label={altText} | |||
role={Element === 'button' ? 'button' : 'img'} | |||
aria-label={Element === 'button' ? altText : undefined} |
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.
nice
Accepting suggestion from Josh. Co-authored-by: Josh <[email protected]>
@@ -191,6 +191,7 @@ export const systemIconStencil = createStencil({ | |||
), | |||
}, | |||
}), | |||
modifiers: {}, |
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.
defaulting this to an empty object. If you extend a stencil and it's missing a property, typescript doesn't know to default to an empty object and crashes.
Summary
Fixes: #2954
Expandable style re-factor is needed with the new cs prop. We will need to update this component to use the new system level tokens via CSS variables.
Release Category
Tokens
Release Note
ExpandableTarget
component is now rendering theBaseButton
component, and may have some small impact on the visual styling of the keyboard focus ring.ExpandableIcon
stencil is extending theSystemIcon
stencil, and may have had an impact on the chevron icon color.Avatar
component where anaria-label
string was rendered on a generic HTML element that did not have an explicit or implicitrole
Checklist
ready for review
has been added to PRFor the Reviewer
Where Should the Reviewer Start?
modules/labs-react/expandable/lib/Expandable.tsx
(all subcomponents)
Line 274: modules/react/avatar/lib/Avatar.tsx
Areas for Feedback? (optional)
Testing Manually
Screenshots or GIFs (if applicable)
Thank You Gif (optional)