/
_details.scss
106 lines (99 loc) · 1.76 KB
/
_details.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
* wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
*/
/* details polyfill */
/* <details> and <summary> are block level elements */
%pe-details-display-block {
display: block;
}
%pe-details-opened {
&:before { /* Add the opened pointer */
content: "\25BC\a0";
}
}
summary {
@extend %pe-details-display-block;
cursor: pointer; /* Apply a pointer cursor upon hover to indicate it’s a clickable element. These styles can be applied regardless of whether the fallback is needed */
@include pseudo-focus { /* Add focus styles (for keyboard accessibility) */
background: #ddd;
}
}
/* Only get applied if JavaScript is enabled and <details> is not natively supported */
details {
@extend %pe-details-display-block;
summary { /* Make sure summary remains visible */
display: block !important;
background: transparent
}
&.polyfill {
> {
summary {
&:before { /* Add the closed pointer */
content: "\25BA\a0";
}
}
}
&.open {
> {
summary {
@extend %pe-details-opened;
}
}
}
}
&[open] {
&.polyfill {
> {
summary {
&:not([role=button]) {
@extend %pe-details-opened;
}
}
}
}
}
&:not([open]) {
> {
* {
display: none;
}
}
}
}
.no-js {
details {
> {
* {
@extend %pe-details-display-block;
}
}
&:not([open]) {
> {
* {
@extend %pe-details-display-block;
}
}
}
}
summary {
cursor: auto;
@include pseudo-focus {
background: none;
}
}
}
/* Right to left (RTL) CSS */
[dir="rtl"] {
details {
&.polyfill {
> {
summary {
&:before { /* Add the close pointer */
content: "\25C0\a0";
}
}
}
}
}
}