File tree Expand file tree Collapse file tree 6 files changed +36
-24
lines changed
styles/sass/60-advanced-components Expand file tree Collapse file tree 6 files changed +36
-24
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ let collapsibles = function () {
20
20
headingsArray . forEach ( function ( heading , index ) {
21
21
22
22
// Insert a button for opening/closing the collapsible section
23
- heading . innerHTML = '<button type="button" class="button--ghost" aria-expanded="false">' + heading . innerHTML + '<svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 320 512" class="icon icon--larger" focusable="false" aria-hidden="true" width="30px" height="30px"><path class="angle-down" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"/><path class="angle-up" d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"/> </svg></button>' ;
23
+ heading . innerHTML = '<button type="button" class="button button --ghost" aria-expanded="false">' + heading . innerHTML + '</svg></button>' ;
24
24
25
25
// Add appropriate aria role to the collapsible section
26
26
heading . nextElementSibling . setAttribute ( 'aria-hidden' , 'true' ) ;
Original file line number Diff line number Diff line change 27
27
width : 100% ;
28
28
}
29
29
30
+ // Decorative chevron
31
+ & ::after {
32
+ block-size : rem (14 );
33
+ border-color : black ;
34
+ border-style : solid ;
35
+ border-width : 0 rem (4 ) rem (4 ) 0 ;
36
+ content : " " ;
37
+ inline-size : rem (14 );
38
+ margin-block-start : rem (4 );
39
+ transform : rotate (45deg );
40
+ }
41
+
30
42
& :hover {
31
43
text-decoration : underline ; /* 1 */
32
44
text-decoration-skip-ink : auto ; // Not supported by Safari
38
50
background-color : $focus-color ;
39
51
text-decoration : none ;
40
52
}
41
-
42
- & [aria-expanded = " false" ] .angle-up {
43
- display : none ;
44
- }
45
-
46
- & [aria-expanded = " true" ] .angle-down {
47
- display : none ;
48
- }
49
-
50
- svg {
51
- flex-shrink : 0 ;
52
- }
53
53
}
54
54
55
+ [data-heading = " collapsibles" ] button [aria-expanded = " true" ] {
56
+ & ::after {
57
+ margin-block-start : rem (10 );
58
+ scale : -1 ;
59
+ }
60
+ }
61
+
55
62
[data-heading = " collapsibles" ] + * {
56
63
& [aria-hidden = " true" ] {
57
64
display : none ;
Original file line number Diff line number Diff line change @@ -417,7 +417,7 @@ let collapsibles = function () {
417
417
// Loop through headings
418
418
headingsArray . forEach ( function ( heading , index ) {
419
419
// Insert a button for opening/closing the collapsible section
420
- heading . innerHTML = '<button type="button" class="button--ghost" aria-expanded="false">' + heading . innerHTML + '<svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 320 512" class="icon icon--larger" focusable="false" aria-hidden="true" width="30px" height="30px"><path class="angle-down" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"/><path class="angle-up" d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"/> </svg></button>' ;
420
+ heading . innerHTML = '<button type="button" class="button button --ghost" aria-expanded="false">' + heading . innerHTML + '</svg></button>' ;
421
421
422
422
// Add appropriate aria role to the collapsible section
423
423
heading . nextElementSibling . setAttribute ( 'aria-hidden' , 'true' ) ;
You can’t perform that action at this time.
0 commit comments