Skip to content

Commit 02b4ab1

Browse files
committed
Style to look like inset text on older browsers
1 parent 0994d7b commit 02b4ab1

File tree

1 file changed

+43
-4
lines changed
  • packages/govuk-frontend/src/govuk/components/details

1 file changed

+43
-4
lines changed

packages/govuk-frontend/src/govuk/components/details/_index.scss

+43-4
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,38 @@
55
@include govuk-responsive-margin(6, "bottom");
66

77
display: block;
8+
9+
border-left: $govuk-border-width-wide solid $govuk-border-colour;
810
}
911

1012
.govuk-details__summary {
1113
// Make the focus outline shrink-wrap the text content of the summary
1214
display: inline-block;
1315

16+
margin-top: govuk-spacing(3);
17+
1418
margin-bottom: govuk-spacing(1);
1519
}
1620

21+
.govuk-details__summary-text {
22+
@include govuk-typography-weight-bold;
23+
@include govuk-responsive-margin(4, "bottom");
24+
padding-left: govuk-spacing(4);
25+
26+
> :first-child {
27+
margin-top: 0;
28+
}
29+
30+
> :only-child,
31+
> :last-child {
32+
margin-bottom: 0;
33+
}
34+
}
35+
1736
.govuk-details__text {
1837
padding-top: govuk-spacing(3);
1938
padding-bottom: govuk-spacing(3);
2039
padding-left: govuk-spacing(4);
21-
border-left: $govuk-border-width solid $govuk-border-colour;
2240
}
2341

2442
.govuk-details__text p {
@@ -30,17 +48,28 @@
3048
margin-bottom: 0;
3149
}
3250

33-
// Fix for older browsers which:
51+
// We wrap styles for newer browsers in a feature query, which is ignored by
52+
// older browsers, which always expand the details element.
53+
//
54+
// Additionally, -ms-ime-align is only supported by Edge 12 - 18
55+
//
56+
// This ensures we don't use these styles in browsers which:
3457
// - support ES6 modules but not the <details> element (Edge 16 - 18)
3558
// - do not support ES6 modules or the <details> element (eg, IE8+)
36-
// -ms-ime-align is only supported by Edge 12 - 18
37-
// Older browsers ignore the entire feature query and use the styles above
3859
@supports not (-ms-ime-align: auto) {
60+
// Override default border
61+
.govuk-details {
62+
border-left: none;
63+
}
64+
3965
.govuk-details__summary {
4066

4167
// Absolutely position the marker against this element
4268
position: relative;
4369

70+
// Override default top margin
71+
margin-top: 0;
72+
4473
// Allow for absolutely positioned marker and align with disclosed text
4574
padding-left: govuk-spacing(4) + $govuk-border-width;
4675

@@ -59,6 +88,12 @@
5988
// ...but only underline the text, not the arrow
6089
.govuk-details__summary-text {
6190
@include govuk-link-decoration;
91+
// Override default font weight
92+
@include govuk-typography-weight-regular;
93+
// Override default margin
94+
margin-bottom: 0;
95+
// Override default padding
96+
padding-left: 0;
6297
}
6398

6499
.govuk-details__summary:hover .govuk-details__summary-text {
@@ -93,5 +128,9 @@
93128
@include govuk-shape-arrow($direction: down, $base: 14px);
94129
}
95130
}
131+
132+
.govuk-details__text {
133+
border-left: $govuk-border-width solid $govuk-border-colour;
134+
}
96135
}
97136
}

0 commit comments

Comments
 (0)