From a30413154ed7d2d0b6c310f769e87455afabf41d Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 14 Oct 2021 05:51:17 +0300 Subject: [PATCH] [Components - ToggleGroupControl]: Fix visual state when no option is selected (#35545) * [Components - ToggleGroupControl]: Fix visual state when no option is selected * don't render backdrop if no target node exists * change initial state value --- .../test/__snapshots__/index.js.snap | 50 +++++-------------- .../toggle-group-control-backdrop.tsx | 10 +++- 2 files changed, 22 insertions(+), 38 deletions(-) diff --git a/packages/components/src/toggle-group-control/test/__snapshots__/index.js.snap b/packages/components/src/toggle-group-control/test/__snapshots__/index.js.snap index 4627ed759e63c..679369cb776cd 100644 --- a/packages/components/src/toggle-group-control/test/__snapshots__/index.js.snap +++ b/packages/components/src/toggle-group-control/test/__snapshots__/index.js.snap @@ -49,25 +49,6 @@ exports[`ToggleGroupControl should render correctly 1`] = ` } .emotion-6 { - background: #1e1e1e; - border-radius: 2px; - box-shadow: transparent; - left: 0; - position: absolute; - top: 2px; - bottom: 2px; - -webkit-transition: -webkit-transform 160ms ease; - transition: transform 160ms ease; - z-index: 1; -} - -@media ( prefers-reduced-motion: reduce ) { - .emotion-6 { - transition-duration: 0ms; - } -} - -.emotion-8 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; @@ -80,7 +61,7 @@ exports[`ToggleGroupControl should render correctly 1`] = ` flex: 1; } -.emotion-10 { +.emotion-8 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; @@ -119,20 +100,20 @@ exports[`ToggleGroupControl should render correctly 1`] = ` } @media ( prefers-reduced-motion: reduce ) { - .emotion-10 { + .emotion-8 { transition-duration: 0ms; } } -.emotion-10::-moz-focus-inner { +.emotion-8::-moz-focus-inner { border: 0; } -.emotion-10:active { +.emotion-8:active { background: #fff; } -.emotion-11 { +.emotion-9 { font-size: 13px; line-height: 1; position: absolute; @@ -144,7 +125,7 @@ exports[`ToggleGroupControl should render correctly 1`] = ` transform: translate( -50%, -50% ); } -.emotion-13 { +.emotion-11 { font-size: 13px; font-weight: bold; height: 0; @@ -182,17 +163,12 @@ exports[`ToggleGroupControl should render correctly 1`] = ` />