Parcourir la source

Bug Fix: `refresh` removed 'aria-live`',

NaotoshiFujita il y a 3 ans
Parent
commit
c845fb0e8c

+ 5 - 1
dist/js/splide.cjs.js

@@ -2782,13 +2782,17 @@ function Live(Splide2, Components2, options) {
 
   function mount() {
     if (enabled) {
-      disable(!Components2.Autoplay.isPaused());
       on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
       on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
+      on([EVENT_MOUNTED, EVENT_REFRESH], init);
       on([EVENT_MOVED, EVENT_SCROLLED], update);
     }
   }
 
+  function init() {
+    disable(!Components2.Autoplay.isPaused());
+  }
+
   function disable(disabled) {
     if (enabled) {
       setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");

+ 5 - 1
dist/js/splide.esm.js

@@ -2777,13 +2777,17 @@ function Live(Splide2, Components2, options) {
 
   function mount() {
     if (enabled) {
-      disable(!Components2.Autoplay.isPaused());
       on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
       on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
+      on([EVENT_MOUNTED, EVENT_REFRESH], init);
       on([EVENT_MOVED, EVENT_SCROLLED], update);
     }
   }
 
+  function init() {
+    disable(!Components2.Autoplay.isPaused());
+  }
+
   function disable(disabled) {
     if (enabled) {
       setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");

+ 5 - 1
dist/js/splide.js

@@ -2776,13 +2776,17 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
     function mount() {
       if (enabled) {
-        disable(!Components2.Autoplay.isPaused());
         on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
         on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
+        on([EVENT_MOUNTED, EVENT_REFRESH], init);
         on([EVENT_MOVED, EVENT_SCROLLED], update);
       }
     }
 
+    function init() {
+      disable(!Components2.Autoplay.isPaused());
+    }
+
     function disable(disabled) {
       if (enabled) {
         setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
dist/js/splide.min.js.map


+ 17 - 2
src/js/components/Live/Live.ts

@@ -1,6 +1,13 @@
 import { ARIA_LIVE } from '../../constants/attributes';
 import { CLASS_SR } from '../../constants/classes';
-import { EVENT_AUTOPLAY_PAUSE, EVENT_AUTOPLAY_PLAY, EVENT_MOVED, EVENT_SCROLLED } from '../../constants/events';
+import {
+  EVENT_AUTOPLAY_PAUSE,
+  EVENT_AUTOPLAY_PLAY,
+  EVENT_MOUNTED,
+  EVENT_MOVED,
+  EVENT_REFRESH,
+  EVENT_SCROLLED,
+} from '../../constants/events';
 import { EventInterface } from '../../constructors';
 import { Splide } from '../../core/Splide/Splide';
 import { BaseComponent, Components, Options } from '../../types';
@@ -52,13 +59,21 @@ export function Live( Splide: Splide, Components: Components, options: Options )
    */
   function mount(): void {
     if ( enabled ) {
-      disable( ! Components.Autoplay.isPaused() );
       on( EVENT_AUTOPLAY_PLAY, apply( disable, true ) );
       on( EVENT_AUTOPLAY_PAUSE, apply( disable, false ) );
+      on( [ EVENT_MOUNTED, EVENT_REFRESH ], init );
       on( [ EVENT_MOVED, EVENT_SCROLLED ], update );
     }
   }
 
+  /**
+   * Initializes the component.
+   * Only when autoplay is paused, enables a live region.
+   */
+  function init(): void {
+    disable( ! Components.Autoplay.isPaused() );
+  }
+
   /**
    * Disables/enables the live region.
    * Does nothing when the `live` option is not enabled.

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff