-
Notifications
You must be signed in to change notification settings - Fork 89
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
fix: refine arrowStyles
CSS
#1812
Conversation
@@ -54,65 +36,77 @@ const animationStyles = (position: ArrowPosition, modifier: string) => { | |||
|
|||
const positionStyles = (position: ArrowPosition, size: string, inset: string) => { | |||
const margin = math(`${size} / -2`); | |||
const placement = math(`${margin} + ${inset}`); | |||
const placement = math(`${margin} + ${inset} - 1`); | |||
const _position = math(`${size} + 4`); |
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.
Where does the 4 come from?
Perhaps renaming _position
to offset
could help better differentiate it from arrow position
? 🤷♂️
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.
Where does the 4 come from?
It was the unit needed to keep consistent with previous as it provided the means to bury a bigger arrow into the base element. TBH I'm not super happy about it.
* 3. Arrow positioning on the base element. | ||
*/ | ||
return css` | ||
&::before { | ||
${propertyRadius!}: 100%; /* [1] */ |
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.
❤️
${propertyRadius!}: 100%; /* [1] */ | ||
clip-path: ${clipPath}; /* [2] */ | ||
clip-path: ${clipPath}; /* [1] */ | ||
${borderCss}; /* [2] */ | ||
} | ||
|
||
&::before, | ||
&::after { |
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.
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.
We need ::after
to retain the box-shadow
inheritance. Otherwise, the arrow pokes out un-shadowed. Not terrible, but the original designs wanted the shadow to follow the arrow.
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.
border-width: inherit; | ||
border-style: inherit; | ||
border-color: transparent; | ||
border: inherit; | ||
background-clip: content-box; | ||
} | ||
|
||
&::after { |
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.
Same as above. ::after
might be superfluous.
Closing in favor of #1814 |
Description
Dark mode is highlighting a shadow overcast problem with Garden arrows. This PR update swaps the
::after
border "peek-through" with the following:border
is inherited on the front side::before
pseudo (box-shadow
continues to be inherited on the back side::after
)none
for the non-arrow sides of the elementclip-path
does the job for all supported browsersThe result is that the arrow must be sized and positioned in order to lay precisely over the base component's border line. All other changes are a result of the need for precision sizing/positioning.
Checklist
design updates will be Garden Designer approved (add the designer as a reviewer)npm start
)renders as expected with reversed (RTL) directionrenders as expected with Bedrock CSS (?bedrock
)tested for WCAG 2.1 AA accessibility compliance