@internetstiftelsen/styleguide 3.0.5 → 3.0.7

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.
@@ -19,6 +19,7 @@ if (gliderElementCourse) {
19
19
  var prevBtns = document.querySelectorAll('.js-glider-prev');
20
20
  var siteMain = document.querySelector('#siteMain');
21
21
  var zoomImages = document.querySelectorAll('.js-zoom.zoom');
22
+ var youtubeVideos = document.querySelectorAll('[data-youtube]');
22
23
  var slideIndex = GliderCourse.getCurrentSlide();
23
24
  var bounding = 0;
24
25
 
@@ -31,6 +32,10 @@ if (gliderElementCourse) {
31
32
  nextBtn.addEventListener('click', function () {
32
33
  GliderCourse.scrollItem(slideIndex += 1, true);
33
34
 
35
+ [].forEach.call(youtubeVideos, function (el) {
36
+ return el.youtube && el.youtube.pauseVideo();
37
+ });
38
+
34
39
  if (siteMain) {
35
40
  bounding = siteMain.getBoundingClientRect();
36
41
  if (bounding.top < 0) {
@@ -45,6 +50,9 @@ if (gliderElementCourse) {
45
50
  [].forEach.call(prevBtns, function (prevBtn) {
46
51
  prevBtn.addEventListener('click', function () {
47
52
  GliderCourse.scrollItem(slideIndex -= 1, true);
53
+ [].forEach.call(youtubeVideos, function (el) {
54
+ return el.youtube && el.youtube.pauseVideo();
55
+ });
48
56
 
49
57
  if (siteMain) {
50
58
  bounding = siteMain.getBoundingClientRect();
@@ -187,6 +187,7 @@ function display() {
187
187
  (0, _focusTrap2.default)(active.el);
188
188
 
189
189
  active.el.setAttribute('aria-hidden', 'false');
190
+ active.el.setAttribute('data-a11y-toggle-open', 'true');
190
191
 
191
192
  if (active.settings.onOpen) {
192
193
  active.settings.onOpen(active.id, active.el);
@@ -254,6 +255,7 @@ function dispatchOnCloseHandlers(el, id) {
254
255
  function close() {
255
256
  if (active) {
256
257
  active.el.setAttribute('aria-hidden', 'true');
258
+ active.el.removeAttribute('data-a11y-toggle-open');
257
259
 
258
260
  if (active.settings.onClose) {
259
261
  active.settings.onClose(active.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
package/src/app.js CHANGED
@@ -37,7 +37,7 @@ if (demoModal) {
37
37
  content: '<p>My modal content.</p>',
38
38
  actions: [
39
39
  {
40
- text: 'Open modal',
40
+ text: 'Close modal',
41
41
  color: 'peacock-light',
42
42
  modifier: 'primary',
43
43
  attrs: {
@@ -13,6 +13,7 @@ if (gliderElementCourse) {
13
13
  const prevBtns = document.querySelectorAll('.js-glider-prev');
14
14
  const siteMain = document.querySelector('#siteMain');
15
15
  const zoomImages = document.querySelectorAll('.js-zoom.zoom');
16
+ const youtubeVideos = document.querySelectorAll('[data-youtube]');
16
17
  let slideIndex = GliderCourse.getCurrentSlide();
17
18
  let bounding = 0;
18
19
 
@@ -25,6 +26,8 @@ if (gliderElementCourse) {
25
26
  nextBtn.addEventListener('click', () => {
26
27
  GliderCourse.scrollItem(slideIndex += 1, true);
27
28
 
29
+ [].forEach.call(youtubeVideos, (el) => el.youtube && el.youtube.pauseVideo());
30
+
28
31
  if (siteMain) {
29
32
  bounding = siteMain.getBoundingClientRect();
30
33
  if (bounding.top < 0) {
@@ -39,6 +42,7 @@ if (gliderElementCourse) {
39
42
  [].forEach.call(prevBtns, (prevBtn) => {
40
43
  prevBtn.addEventListener('click', () => {
41
44
  GliderCourse.scrollItem(slideIndex -= 1, true);
45
+ [].forEach.call(youtubeVideos, (el) => el.youtube && el.youtube.pauseVideo());
42
46
 
43
47
  if (siteMain) {
44
48
  bounding = siteMain.getBoundingClientRect();
@@ -164,6 +164,7 @@ function display() {
164
164
  focusTrap(active.el);
165
165
 
166
166
  active.el.setAttribute('aria-hidden', 'false');
167
+ active.el.setAttribute('data-a11y-toggle-open', 'true');
167
168
 
168
169
  if (active.settings.onOpen) {
169
170
  active.settings.onOpen(active.id, active.el);
@@ -229,6 +230,7 @@ function dispatchOnCloseHandlers(el, id) {
229
230
  function close() {
230
231
  if (active) {
231
232
  active.el.setAttribute('aria-hidden', 'true');
233
+ active.el.removeAttribute('data-a11y-toggle-open');
232
234
 
233
235
  if (active.settings.onClose) {
234
236
  active.settings.onClose(active.id);