-
Notifications
You must be signed in to change notification settings - Fork 91
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 to avoid overcast issues with drop shadows
#1814
Conversation
arrowStyle
css to avoid issues with drop-shadows
arrowStyle
css to avoid issues with drop-shadowsarrowStyle
css to avoid issues with drop shadows
arrowStyle
css to avoid issues with drop shadowsarrowStyle
CSS to avoid overcast issues with drop shadows
@@ -34,7 +34,7 @@ export const StyledMenu = styled(StyledListbox).attrs({ | |||
props.arrowPosition && | |||
arrowStyles(props.arrowPosition, { | |||
size: `${props.theme.space.base * 2}px`, | |||
inset: '2px', | |||
inset: '1.5px', // More consistent cross-browser positioning with 1.5px |
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 handles positioning differently than other browsers. 😠
arrowStyle
CSS to avoid overcast issues with drop shadowsarrowStyles
CSS to avoid overcast issues with drop shadows
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.
This is feeling really good. Can we pick up the story updates from #1812 to get a more precise match with real component usage.
* 1. Arrow positioning on the base element. | ||
* 2. Rotate the clipping mask depending on 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.
[nit] please re-order so the comments read top-to-bottom with the CSS below
const inset = options.inset || '0'; | ||
const squareSize = math(`${size} * 2 / sqrt(2)`, exponentialSymbols); | ||
const size = options.size === undefined ? 6 : (stripUnit(options.size) as number); | ||
const squareSize = `${Math.round((size * 2) / Math.sqrt(2))}px`; |
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'm glad this works. I was having problems and needed Math.floor
.
* 4. Clip the inner square forming the arrow body into a triangle so that it | ||
* doesn't interfere with container content. | ||
* 5. Clip the outer square forming the arrow border into a triangle so that the | ||
* border merge with the container's. |
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.
[nit] ditto re: top-to-bottom order
Description
Improves
arrowStyles
to avoid overcast issues on arrow border when drop shadows are applied to the arrow container.Using an extreme case to highlight the impact of drop shadows on the arrow border
Detail
::before
(in pink) inherits the border styles from container. The clipping mask is set so that the border smoothly merges with the container's (usinginset == 0
). The overlap is meant to prevent a gap due to pixel rounding.::after
(in green) has a transparent border and a clipping mask that slightly extends upward to conceal the container's border without hiding its content.Checklist
reviewer)
npm start
)⬅️ renders as expected with reversed (RTL) direction🤘 renders as expected with Bedrock CSS (?bedrock
)♿ tested for WCAG 2.1 AA accessibility compliance