shoelace-style/webawesome

Dynamically adding/removing carousel slides with the `loop` property is glitchy

Open

#2,173 建立於 2026年3月16日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)TypeScript (157 fork)github user discovery
bughelp wanted

倉庫指標

Star
 (1,104 star)
PR 合併指標
 (PR 指標待抓取)

描述

Describe the bug

When adding slides to a looping sl-carousel dynamically, the clone slides present challenges.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the sl-carousel docs page
  2. Scroll to the add/remove example
  3. Modify the dom in your browser to add the loop attribute to the sl-carousel
  4. Try to use the example to add/remove slides.

Additional information

This could probably be solved by having the clone slides live outside the slot.

Pseudocode alert!

render() {
...
  if (loop) {
    <sl-carousel-clone></sl-carousel-clone>
  }
  <slot></slot>
  if (loop) {
    <sl-carousel-clone></sl-carousel-clone>
  }
...
}

貢獻者指南