Skip to content

Commit

Permalink
Fix compatibility issue between Popover and Button (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Oct 14, 2021
1 parent ed09eee commit 8402e6b
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 69 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-pets-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': patch
---

Fixed a compatibility issue between the Popover and Button where the Button content would remain visible when the Popover was closed.
4 changes: 2 additions & 2 deletions packages/circuit-ui/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const spinnerLoadingStyles = ({ isLoading }: { isLoading: boolean }) =>
isLoading &&
css`
opacity: 1;
visibility: visible;
visibility: inherit;
`;

const LoadingIcon = styled(Spinner)<{ isLoading: boolean }>(
Expand All @@ -302,7 +302,7 @@ const contentStyles = ({ theme }: StyleProps) => css`
display: inline-flex;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
transform: scale3d(1, 1, 1);
transition: opacity ${theme.transitions.default},
transform ${theme.transitions.default},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ exports[`Button should render with loading styles 1`] = `
-webkit-transition: opacity 120ms ease-in-out,visibility 120ms ease-in-out;
transition: opacity 120ms ease-in-out,visibility 120ms ease-in-out;
opacity: 1;
visibility: visible;
visibility: inherit;
}
.circuit-2 {
Expand All @@ -138,7 +138,7 @@ exports[`Button should render with loading styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -296,7 +296,7 @@ exports[`Button styles should render a button with icon 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -464,7 +464,7 @@ exports[`Button styles should render a disabled button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -612,7 +612,7 @@ exports[`Button styles should render a giga button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -759,7 +759,7 @@ exports[`Button styles should render a kilo button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -906,7 +906,7 @@ exports[`Button styles should render a primary button by default 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1053,7 +1053,7 @@ exports[`Button styles should render a secondary button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1201,7 +1201,7 @@ exports[`Button styles should render a stretched button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1348,7 +1348,7 @@ exports[`Button styles should render a tertiary button 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ exports[`ButtonGroup Center aligment should render with center alignment styles
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -451,7 +451,7 @@ exports[`ButtonGroup Left aligment should render with left alignment styles 1`]
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -732,7 +732,7 @@ exports[`ButtonGroup should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -993,7 +993,7 @@ exports[`ButtonGroup should render with the actions prop 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ exports[`Carousel styles should render with children as a function 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1106,7 +1106,7 @@ exports[`Carousel styles should render with children as a node 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1771,7 +1771,7 @@ exports[`Carousel styles should render with default paused styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -2407,7 +2407,7 @@ exports[`Carousel styles should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ exports[`Buttons styles should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ exports[`CloseButton should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ exports[`Hamburger should render with active styles when passed the isActive pro
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -373,7 +373,7 @@ exports[`Hamburger should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -596,7 +596,7 @@ exports[`Hamburger should render with giga styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -819,7 +819,7 @@ exports[`Hamburger should render with kilo styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exports[`IconButton should render with the default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion packages/circuit-ui/components/ImageInput/ImageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const spinnerLoadingStyles = ({ isLoading }: LoadingIconProps) =>
isLoading &&
css`
opacity: 1;
visibility: visible;
visibility: inherit;
`;

const LoadingIcon = styled(Spinner)<LoadingIconProps>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ exports[`ImageInput styles should render a custom component 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -625,7 +625,7 @@ exports[`ImageInput styles should render with an existing image 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1000,7 +1000,7 @@ exports[`ImageInput styles should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -1379,7 +1379,7 @@ exports[`ImageInput styles should render with invalid styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ exports[`Modal should match the snapshot 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ exports[`NotificationBanner styles should render a promotional banner 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -463,7 +463,7 @@ exports[`NotificationBanner styles should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ exports[`Pagination with 2 to 5 pages should render with default styles 1`] = `
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down Expand Up @@ -703,7 +703,7 @@ exports[`Pagination with more than 5 pages should render with default styles 1`]
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ li:last-child .circuit-1 {
-ms-flex-align: center;
align-items: center;
opacity: 1;
visibility: visible;
visibility: inherit;
-webkit-transform: scale3d(1, 1, 1);
-moz-transform: scale3d(1, 1, 1);
-ms-transform: scale3d(1, 1, 1);
Expand Down
7 changes: 5 additions & 2 deletions packages/circuit-ui/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ const menuBaseStyles = ({ theme }: StyleProps) => css`
border-radius: ${theme.borderRadius.byte};
background-color: ${theme.colors.white};
visibility: hidden;
opacity: 0;
${theme.mq.untilKilo} {
opacity: 1;
transform: translateY(100%);
transition: transform ${theme.transitions.default},
visibility ${theme.transitions.default};
Expand All @@ -156,7 +158,8 @@ type OpenProps = { isOpen: boolean };
const menuOpenStyles = ({ theme, isOpen }: StyleProps & OpenProps) =>
isOpen &&
css`
visibility: visible;
opacity: 1;
visibility: inherit;
${theme.mq.untilKilo} {
transform: translateY(0);
Expand Down Expand Up @@ -193,7 +196,7 @@ const overlayOpenStyles = ({ theme, isOpen }: StyleProps & OpenProps) =>
isOpen &&
css`
${theme.mq.untilKilo} {
visibility: visible;
visibility: inherit;
opacity: 1;
}
`;
Expand Down
Loading

1 comment on commit 8402e6b

@vercel
Copy link

@vercel vercel bot commented on 8402e6b Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.