|
7 | 7 | display: block;
|
8 | 8 | }
|
9 | 9 |
|
10 |
| - .govuk-details__text { |
11 |
| - padding-top: govuk-spacing(3); |
12 |
| - padding-bottom: govuk-spacing(3); |
13 |
| - padding-left: govuk-spacing(4); |
14 |
| - border-left: $govuk-border-width solid $govuk-border-colour; |
15 |
| - } |
16 |
| - |
17 | 10 | .govuk-details__summary {
|
| 11 | + // Make the focus outline shrink-wrap the text content of the summary |
| 12 | + display: inline-block; |
| 13 | + |
| 14 | + // Absolutely position the marker against this element |
| 15 | + position: relative; |
| 16 | + |
18 | 17 | margin-bottom: govuk-spacing(1);
|
| 18 | + |
| 19 | + // Allow for absolutely positioned marker and align with disclosed text |
| 20 | + padding-left: govuk-spacing(4) + $govuk-border-width; |
| 21 | + |
| 22 | + // Style the summary to look like a link... |
| 23 | + color: $govuk-link-colour; |
| 24 | + cursor: pointer; |
| 25 | + |
| 26 | + &:hover { |
| 27 | + color: $govuk-link-hover-colour; |
| 28 | + } |
| 29 | + |
| 30 | + &:focus { |
| 31 | + @include govuk-focused-text; |
| 32 | + } |
19 | 33 | }
|
20 | 34 |
|
21 |
| - @supports not (-ms-ime-align: auto) { |
22 |
| - .govuk-details__summary { |
23 |
| - // Make the focus outline shrink-wrap the text content of the summary |
24 |
| - display: inline-block; |
| 35 | + // ...but only underline the text, not the arrow |
| 36 | + .govuk-details__summary-text { |
| 37 | + @include govuk-link-decoration; |
| 38 | + } |
25 | 39 |
|
26 |
| - // Absolutely position the marker against this element |
27 |
| - position: relative; |
| 40 | + .govuk-details__summary:hover .govuk-details__summary-text { |
| 41 | + @include govuk-link-hover-decoration; |
| 42 | + } |
28 | 43 |
|
29 |
| - // Allow for absolutely positioned marker and align with disclosed text |
30 |
| - padding-left: govuk-spacing(4) + $govuk-border-width; |
| 44 | + // Remove the underline when focussed to avoid duplicate borders |
| 45 | + .govuk-details__summary:focus .govuk-details__summary-text { |
| 46 | + text-decoration: none; |
| 47 | + } |
31 | 48 |
|
32 |
| - // Style the summary to look like a link... |
33 |
| - color: $govuk-link-colour; |
34 |
| - cursor: pointer; |
| 49 | + // Remove the default details marker so we can style our own consistently and |
| 50 | + // ensure it displays in Firefox (see implementation.md for details) |
| 51 | + .govuk-details__summary::-webkit-details-marker { |
| 52 | + display: none; |
| 53 | + } |
35 | 54 |
|
36 |
| - &:hover { |
37 |
| - color: $govuk-link-hover-colour; |
38 |
| - } |
| 55 | + // Append our own open / closed marker using a pseudo-element |
| 56 | + .govuk-details__summary::before { |
| 57 | + content: ""; |
| 58 | + position: absolute; |
39 | 59 |
|
40 |
| - &:focus { |
41 |
| - @include govuk-focused-text; |
42 |
| - } |
43 |
| - } |
44 |
| - // ...but only underline the text, not the arrow |
45 |
| - .govuk-details__summary-text { |
46 |
| - @include govuk-link-decoration; |
47 |
| - } |
| 60 | + top: -1px; |
| 61 | + bottom: 0; |
| 62 | + left: 0; |
48 | 63 |
|
49 |
| - .govuk-details__summary:hover .govuk-details__summary-text { |
50 |
| - @include govuk-link-hover-decoration; |
51 |
| - } |
| 64 | + margin: auto; |
52 | 65 |
|
53 |
| - // Remove the underline when focussed to avoid duplicate borders |
54 |
| - .govuk-details__summary:focus .govuk-details__summary-text { |
55 |
| - text-decoration: none; |
56 |
| - } |
| 66 | + @include govuk-shape-arrow($direction: right, $base: 14px); |
57 | 67 |
|
58 |
| - // Remove the default details marker so we can style our own consistently and |
59 |
| - // ensure it displays in Firefox (see implementation.md for details) |
60 |
| - .govuk-details__summary::-webkit-details-marker { |
61 |
| - display: none; |
| 68 | + .govuk-details[open] > & { |
| 69 | + @include govuk-shape-arrow($direction: down, $base: 14px); |
62 | 70 | }
|
| 71 | + } |
63 | 72 |
|
64 |
| - // Append our own open / closed marker using a pseudo-element |
65 |
| - .govuk-details__summary::before { |
66 |
| - content: ""; |
67 |
| - position: absolute; |
| 73 | + .govuk-details__text { |
| 74 | + padding-top: govuk-spacing(3); |
| 75 | + padding-bottom: govuk-spacing(3); |
| 76 | + padding-left: govuk-spacing(4); |
| 77 | + border-left: $govuk-border-width solid $govuk-border-colour; |
| 78 | + } |
| 79 | + |
| 80 | + .govuk-details__text p { |
| 81 | + margin-top: 0; |
| 82 | + margin-bottom: govuk-spacing(4); |
| 83 | + } |
68 | 84 |
|
69 |
| - top: -1px; |
70 |
| - bottom: 0; |
71 |
| - left: 0; |
| 85 | + .govuk-details__text > :last-child { |
| 86 | + margin-bottom: 0; |
| 87 | + } |
72 | 88 |
|
73 |
| - margin: auto; |
| 89 | + @supports (-ms-ime-align: auto) { |
| 90 | + .govuk-details__summary { |
74 | 91 |
|
75 |
| - @include govuk-shape-arrow($direction: right, $base: 14px); |
| 92 | + padding-left: 0; |
| 93 | + color: $govuk-text-colour; |
76 | 94 |
|
77 |
| - .govuk-details[open] > & { |
78 |
| - @include govuk-shape-arrow($direction: down, $base: 14px); |
| 95 | + cursor: text; |
| 96 | + |
| 97 | + &:hover, |
| 98 | + &:focus { |
| 99 | + color: $govuk-text-colour; |
79 | 100 | }
|
80 | 101 | }
|
81 | 102 |
|
82 |
| - .govuk-details__text p { |
83 |
| - margin-top: 0; |
84 |
| - margin-bottom: govuk-spacing(4); |
| 103 | + .govuk-details__summary-text { |
| 104 | + @include govuk-text-colour; |
| 105 | + text-decoration: none; |
85 | 106 | }
|
86 | 107 |
|
87 |
| - .govuk-details__text > :last-child { |
88 |
| - margin-bottom: 0; |
| 108 | + .govuk-details__summary::before { |
| 109 | + content: none; |
| 110 | + position: static; |
89 | 111 | }
|
90 | 112 | }
|
91 | 113 | }
|
0 commit comments