@nys-cui/cui-section 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/section.js +10 -4
package/package.json
CHANGED
package/src/section.js
CHANGED
|
@@ -40,7 +40,7 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
40
40
|
|
|
41
41
|
sTemplate += `
|
|
42
42
|
<div class="header-controls">
|
|
43
|
-
<button type="button" id="collapse-control">
|
|
43
|
+
<button type="button" id="collapse-control" aria-controls="container">
|
|
44
44
|
<cui-icon src="caret-down" base="${this.sIconBasePath}"></cui-icon>
|
|
45
45
|
</button>
|
|
46
46
|
</div>`;
|
|
@@ -50,7 +50,7 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
50
50
|
|
|
51
51
|
sTemplate += `
|
|
52
52
|
<div class="header-controls">
|
|
53
|
-
<button type="button" id="collapse-control">
|
|
53
|
+
<button type="button" id="collapse-control" aria-controls="container">
|
|
54
54
|
<cui-icon src="caret-down"></cui-icon>
|
|
55
55
|
</button>
|
|
56
56
|
</div>`;
|
|
@@ -76,12 +76,15 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
76
76
|
|
|
77
77
|
// mark the section as "currently not collapsed"
|
|
78
78
|
dContainer.setAttribute('data-collapsed', 'false');
|
|
79
|
+
dContainer.setAttribute('aria-expanded', 'true');
|
|
79
80
|
|
|
80
81
|
// remove this event listener so it only gets triggered once
|
|
81
82
|
dContainer.removeEventListener('transitionend', transitionEnd, this);
|
|
82
83
|
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
dContainer.removeAttribute('aria-expanded');
|
|
87
|
+
|
|
85
88
|
this.bLock = true;
|
|
86
89
|
|
|
87
90
|
var sectionHeight = dContainer.scrollHeight;
|
|
@@ -98,15 +101,18 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
98
101
|
collapse(dContainer) {
|
|
99
102
|
|
|
100
103
|
function transitionEnd(e) {
|
|
104
|
+
|
|
105
|
+
dContainer.style.height = "";
|
|
101
106
|
|
|
102
107
|
// mark the section as "currently collapsed"
|
|
103
108
|
dContainer.setAttribute('data-collapsed', 'true');
|
|
104
|
-
|
|
105
|
-
dContainer.style.height = "";
|
|
109
|
+
dContainer.setAttribute('aria-expanded', 'false');
|
|
106
110
|
|
|
107
111
|
dContainer.removeEventListener('transitionend', transitionEnd, true);
|
|
108
112
|
}
|
|
109
113
|
|
|
114
|
+
dContainer.removeAttribute('aria-expanded');
|
|
115
|
+
|
|
110
116
|
// get the height of the dContainer's inner content, regardless of its actual size
|
|
111
117
|
var sectionHeight = dContainer.scrollHeight;
|
|
112
118
|
|