|
1 | 1 | /* For animation technique see https://css-tricks.com/css-grid-can-do-auto-height-transitions/ */ |
2 | 2 |
|
3 | | -@layer kol-component { |
4 | | - .collapsible { |
5 | | - @media (prefers-reduced-motion) { |
6 | | - &__wrapper-animation, |
7 | | - &__wrapper { |
8 | | - transition: none !important; |
9 | | - } |
| 3 | +.collapsible { |
| 4 | + @media (prefers-reduced-motion) { |
| 5 | + &__wrapper-animation, |
| 6 | + &__wrapper { |
| 7 | + transition: none !important; |
10 | 8 | } |
| 9 | + } |
11 | 10 |
|
12 | | - /* @see https://github.com/public-ui/kolibri/issues/5952 */ |
13 | | - @media print { |
14 | | - :not(.collapsible--open) &__wrapper-animation { |
15 | | - display: none; |
16 | | - } |
17 | | - } |
18 | | - &__wrapper { |
19 | | - /* Forces the element into its own GPU compositing layer (via 3D transform). Helps prevent rendering/layout bugs (e.g. #7511) and may improve animation performance. */ |
20 | | - transform: translateZ(0); |
21 | | - display: grid; |
22 | | - grid-template-rows: 0fr; |
23 | | - transition: grid-template-rows 0.3s; |
| 11 | + /* @see https://github.com/public-ui/kolibri/issues/5952 */ |
| 12 | + @media print { |
| 13 | + :not(.collapsible--open) &__wrapper-animation { |
| 14 | + display: none; |
24 | 15 | } |
| 16 | + } |
| 17 | + &__wrapper { |
| 18 | + /* Forces the element into its own GPU compositing layer (via 3D transform). Helps prevent rendering/layout bugs (e.g. #7511) and may improve animation performance. */ |
| 19 | + transform: translateZ(0); |
| 20 | + display: grid; |
| 21 | + grid-template-rows: 0fr; |
| 22 | + transition: grid-template-rows 0.3s; |
| 23 | + } |
25 | 24 |
|
26 | | - &__wrapper-animation { |
27 | | - opacity: 0; |
28 | | - transform: scaleY(0); |
29 | | - transform-origin: top; |
30 | | - min-height: 0; |
| 25 | + &__wrapper-animation { |
| 26 | + opacity: 0; |
| 27 | + transform: scaleY(0); |
| 28 | + transform-origin: top; |
| 29 | + min-height: 0; |
31 | 30 |
|
32 | | - /* This property is important to keep in sync with the visual transition (template-rows). Without it interactive elements within the accordion would stay focusable. */ |
33 | | - visibility: hidden; |
| 31 | + /* This property is important to keep in sync with the visual transition (template-rows). Without it interactive elements within the accordion would stay focusable. */ |
| 32 | + visibility: hidden; |
34 | 33 |
|
35 | | - transition: |
36 | | - transform 0.3s, |
37 | | - opacity 0.3s, |
38 | | - visibility 0.3s; |
39 | | - } |
| 34 | + transition: |
| 35 | + transform 0.3s, |
| 36 | + opacity 0.3s, |
| 37 | + visibility 0.3s; |
| 38 | + } |
40 | 39 |
|
41 | | - &--open &__wrapper { |
42 | | - grid-template-rows: 1fr; |
43 | | - } |
| 40 | + &--open &__wrapper { |
| 41 | + grid-template-rows: 1fr; |
| 42 | + } |
44 | 43 |
|
45 | | - &--open &__wrapper-animation { |
46 | | - opacity: 1; |
47 | | - transform: scaleY(1); |
| 44 | + &--open &__wrapper-animation { |
| 45 | + opacity: 1; |
| 46 | + transform: scaleY(1); |
48 | 47 |
|
49 | | - visibility: visible; |
50 | | - } |
| 48 | + visibility: visible; |
| 49 | + } |
51 | 50 |
|
52 | | - /* |
| 51 | + /* |
53 | 52 | * Inside a button, the caption text is always centered. |
54 | 53 | * So we have to align the text to the left. |
55 | 54 | */ |
56 | | - &__heading-button button { |
57 | | - .kol-span { |
58 | | - align-items: flex-start; |
59 | | - } |
| 55 | + &__heading-button button { |
| 56 | + .kol-span { |
| 57 | + align-items: flex-start; |
60 | 58 | } |
61 | 59 | } |
| 60 | +} |
62 | 61 |
|
63 | | - .collapsible--open:focus-within { |
64 | | - position: relative; |
65 | | - z-index: 100; |
66 | | - } |
| 62 | +.collapsible--open:focus-within { |
| 63 | + position: relative; |
| 64 | + z-index: 100; |
67 | 65 | } |
0 commit comments