Skip to content

Commit ff62053

Browse files
committed
[WIP] Override default styles for older browsers
1 parent 28a12fa commit ff62053

File tree

1 file changed

+78
-56
lines changed
  • packages/govuk-frontend/src/govuk/components/details

1 file changed

+78
-56
lines changed

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

+78-56
Original file line numberDiff line numberDiff line change
@@ -7,85 +7,107 @@
77
display: block;
88
}
99

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-
1710
.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+
1817
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+
}
1933
}
2034

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+
}
2539

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+
}
2843

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+
}
3148

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+
}
3554

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;
3959

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;
4863

49-
.govuk-details__summary:hover .govuk-details__summary-text {
50-
@include govuk-link-hover-decoration;
51-
}
64+
margin: auto;
5265

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);
5767

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);
6270
}
71+
}
6372

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+
}
6884

69-
top: -1px;
70-
bottom: 0;
71-
left: 0;
85+
.govuk-details__text > :last-child {
86+
margin-bottom: 0;
87+
}
7288

73-
margin: auto;
89+
@supports (-ms-ime-align: auto) {
90+
.govuk-details__summary {
7491

75-
@include govuk-shape-arrow($direction: right, $base: 14px);
92+
padding-left: 0;
93+
color: $govuk-text-colour;
7694

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;
79100
}
80101
}
81102

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;
85106
}
86107

87-
.govuk-details__text > :last-child {
88-
margin-bottom: 0;
108+
.govuk-details__summary::before {
109+
content: none;
110+
position: static;
89111
}
90112
}
91113
}

0 commit comments

Comments
 (0)