Skip to content

Commit

Permalink
[wb-1797-cell-color-contrast] Set inner wrapper styles using a class …
Browse files Browse the repository at this point in the history
…instead
  • Loading branch information
beaesguerra committed Jan 23, 2025
1 parent 018a3b9 commit 862e3c3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/wonder-blocks-cell/src/components/internal/cell-core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ function CellInner(props: CellCoreProps): React.ReactElement {
horizontalRuleStyles,
active && styles.activeInnerWrapper,
]}
// Set className so we can set styles on the inner wrapper directly
// when the clickable element is pressed
className="inner-wrapper"
>
{/* Left accessory */}
<LeftAccessory
Expand Down Expand Up @@ -345,11 +348,13 @@ const styles = StyleSheet.create({
background: color.fadedBlue8,
},
// press + enabled + not currently selected (active prop: false)
// Using the first child to apply the left bar indicator on the pressed
// state because setting the styles on the clickable element
// directly causes issues since overflow must be hidden for cases where
// the border is rounded
[":active[aria-disabled=false]:not([aria-current=true]) > *:first-child" as any]:
// We apply the left bar indicator styles on the inner-wrapper element
// instead of the clickable element directly because we need to hide the
// left bar overflow when custom cell styles apply a border-radius. We
// have overflow: hidden on the inner wrapper instead of the clickable element
// because setting it on the clickable element causes issues with existing
// cases.
[":active[aria-disabled=false]:not([aria-current=true]) .inner-wrapper" as any]:
{
position: "relative",
":before": {
Expand Down

0 comments on commit 862e3c3

Please sign in to comment.