浏览代码

Collects focusable nodes every time when checking slide visibility in case that they are added/removed after initialization.

Naotoshi Fujita 2 年之前
父节点
当前提交
e37a2071e9
共有 8 个文件被更改,包括 14 次插入18 次删除
  1. 2 3
      dist/js/splide.cjs.js
  2. 2 3
      dist/js/splide.esm.js
  3. 2 3
      dist/js/splide.js
  4. 0 0
      dist/js/splide.min.js
  5. 二进制
      dist/js/splide.min.js.gz
  6. 0 0
      dist/js/splide.min.js.map
  7. 1 1
      package.json
  8. 7 8
      src/js/components/Slides/Slide.ts

+ 2 - 3
dist/js/splide.cjs.js

@@ -1,6 +1,6 @@
 /*!
 /*!
  * Splide.js
  * Splide.js
- * Version  : 4.0.7
+ * Version  : 4.0.8
  * License  : MIT
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  * Copyright: 2022 Naotoshi Fujita
  */
  */
@@ -894,7 +894,6 @@ function Slide$1(Splide2, index, slideIndex, slide) {
   var label = getAttribute(slide, ARIA_LABEL);
   var label = getAttribute(slide, ARIA_LABEL);
   var isClone = slideIndex > -1;
   var isClone = slideIndex > -1;
   var container = child(slide, "." + CLASS_CONTAINER);
   var container = child(slide, "." + CLASS_CONTAINER);
-  var focusableNodes = queryAll(slide, options.focusableNodes || "");
   var destroyed;
   var destroyed;
 
 
   function mount() {
   function mount() {
@@ -973,7 +972,7 @@ function Slide$1(Splide2, index, slideIndex, slide) {
       setAttribute(slide, ARIA_HIDDEN, hidden || "");
       setAttribute(slide, ARIA_HIDDEN, hidden || "");
     }
     }
 
 
-    setAttribute(focusableNodes, TAB_INDEX, hidden ? -1 : "");
+    setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
 
 
     if (slideFocus) {
     if (slideFocus) {
       setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
       setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);

+ 2 - 3
dist/js/splide.esm.js

@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 
 /*!
 /*!
  * Splide.js
  * Splide.js
- * Version  : 4.0.7
+ * Version  : 4.0.8
  * License  : MIT
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  * Copyright: 2022 Naotoshi Fujita
  */
  */
@@ -889,7 +889,6 @@ function Slide$1(Splide2, index, slideIndex, slide) {
   var label = getAttribute(slide, ARIA_LABEL);
   var label = getAttribute(slide, ARIA_LABEL);
   var isClone = slideIndex > -1;
   var isClone = slideIndex > -1;
   var container = child(slide, "." + CLASS_CONTAINER);
   var container = child(slide, "." + CLASS_CONTAINER);
-  var focusableNodes = queryAll(slide, options.focusableNodes || "");
   var destroyed;
   var destroyed;
 
 
   function mount() {
   function mount() {
@@ -968,7 +967,7 @@ function Slide$1(Splide2, index, slideIndex, slide) {
       setAttribute(slide, ARIA_HIDDEN, hidden || "");
       setAttribute(slide, ARIA_HIDDEN, hidden || "");
     }
     }
 
 
-    setAttribute(focusableNodes, TAB_INDEX, hidden ? -1 : "");
+    setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
 
 
     if (slideFocus) {
     if (slideFocus) {
       setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
       setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);

+ 2 - 3
dist/js/splide.js

@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 
 /*!
 /*!
  * Splide.js
  * Splide.js
- * Version  : 4.0.7
+ * Version  : 4.0.8
  * License  : MIT
  * License  : MIT
  * Copyright: 2022 Naotoshi Fujita
  * Copyright: 2022 Naotoshi Fujita
  */
  */
@@ -887,7 +887,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
     var label = getAttribute(slide, ARIA_LABEL);
     var label = getAttribute(slide, ARIA_LABEL);
     var isClone = slideIndex > -1;
     var isClone = slideIndex > -1;
     var container = child(slide, "." + CLASS_CONTAINER);
     var container = child(slide, "." + CLASS_CONTAINER);
-    var focusableNodes = queryAll(slide, options.focusableNodes || "");
     var destroyed;
     var destroyed;
 
 
     function mount() {
     function mount() {
@@ -966,7 +965,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
         setAttribute(slide, ARIA_HIDDEN, hidden || "");
         setAttribute(slide, ARIA_HIDDEN, hidden || "");
       }
       }
 
 
-      setAttribute(focusableNodes, TAB_INDEX, hidden ? -1 : "");
+      setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
 
 
       if (slideFocus) {
       if (slideFocus) {
         setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
         setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);

文件差异内容过多而无法显示
+ 0 - 0
dist/js/splide.min.js


二进制
dist/js/splide.min.js.gz


文件差异内容过多而无法显示
+ 0 - 0
dist/js/splide.min.js.map


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@splidejs/splide",
   "name": "@splidejs/splide",
-  "version": "4.0.7",
+  "version": "4.0.8",
   "description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
   "description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
   "author": "Naotoshi Fujita",
   "author": "Naotoshi Fujita",
   "license": "MIT",
   "license": "MIT",

+ 7 - 8
src/js/components/Slides/Slide.ts

@@ -73,7 +73,7 @@ export interface  SlideComponent extends BaseComponent {
 }
 }
 
 
 /**
 /**
- * The sub component for managing each slide.
+ * The subcomponent for managing each slide.
  *
  *
  * @since 3.0.0
  * @since 3.0.0
  *
  *
@@ -82,7 +82,7 @@ export interface  SlideComponent extends BaseComponent {
  * @param slideIndex - A slide index for clones. This must be `-1` if the slide is not a clone.
  * @param slideIndex - A slide index for clones. This must be `-1` if the slide is not a clone.
  * @param slide      - A slide element.
  * @param slide      - A slide element.
  *
  *
- * @return A Slide sub component.
+ * @return A Slide subcomponent.
  */
  */
 export function Slide( Splide: Splide, index: number, slideIndex: number, slide: HTMLElement ): SlideComponent {
 export function Slide( Splide: Splide, index: number, slideIndex: number, slide: HTMLElement ): SlideComponent {
   const event = EventInterface( Splide );
   const event = EventInterface( Splide );
@@ -90,11 +90,10 @@ export function Slide( Splide: Splide, index: number, slideIndex: number, slide:
   const { Components, root, options } = Splide;
   const { Components, root, options } = Splide;
   const { isNavigation, updateOnMove, i18n, pagination, slideFocus } = options;
   const { isNavigation, updateOnMove, i18n, pagination, slideFocus } = options;
   const { resolve } = Components.Direction;
   const { resolve } = Components.Direction;
-  const styles         = getAttribute( slide, 'style' );
-  const label          = getAttribute( slide, ARIA_LABEL );
-  const isClone        = slideIndex > -1;
-  const container      = child( slide, `.${ CLASS_CONTAINER }` );
-  const focusableNodes = queryAll( slide, options.focusableNodes || '' );
+  const styles    = getAttribute( slide, 'style' );
+  const label     = getAttribute( slide, ARIA_LABEL );
+  const isClone   = slideIndex > -1;
+  const container = child( slide, `.${ CLASS_CONTAINER }` );
 
 
   /**
   /**
    * Turns into `true` when the component is destroyed.
    * Turns into `true` when the component is destroyed.
@@ -205,7 +204,7 @@ export function Slide( Splide: Splide, index: number, slideIndex: number, slide:
       setAttribute( slide, ARIA_HIDDEN, hidden || '' );
       setAttribute( slide, ARIA_HIDDEN, hidden || '' );
     }
     }
 
 
-    setAttribute( focusableNodes, TAB_INDEX, hidden ? -1 : '' );
+    setAttribute( queryAll( slide, options.focusableNodes || '' ), TAB_INDEX, hidden ? -1 : '' );
 
 
     if ( slideFocus ) {
     if ( slideFocus ) {
       setAttribute( slide, TAB_INDEX, hidden ? -1 : 0 );
       setAttribute( slide, TAB_INDEX, hidden ? -1 : 0 );

部分文件因为文件数量过多而无法显示