From 5111852f8d8b1104c36095fd8f1bd81dff66fa7a Mon Sep 17 00:00:00 2001 From: anubra266 Date: Thu, 5 Dec 2024 14:03:52 -0800 Subject: [PATCH] chore: data-loaded --- packages/machines/carousel/src/carousel.connect.ts | 2 ++ shared/src/css/carousel.css | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packages/machines/carousel/src/carousel.connect.ts b/packages/machines/carousel/src/carousel.connect.ts index b805a7b09c..0a45e15cec 100644 --- a/packages/machines/carousel/src/carousel.connect.ts +++ b/packages/machines/carousel/src/carousel.connect.ts @@ -59,6 +59,7 @@ export function connect(state: State, send: Send, normalize role: "region", "aria-roledescription": "carousel", "data-orientation": state.context.orientation, + "data-loaded": dataAttr(state.context.views.length > 0), dir: state.context.dir, "aria-label": "Carousel", style: { @@ -72,6 +73,7 @@ export function connect(state: State, send: Send, normalize ...parts.itemGroup.attrs, id: dom.getItemGroupId(state.context), "data-orientation": state.context.orientation, + "data-loaded": dataAttr(state.context.views.length > 0), dir: state.context.dir, tabIndex: 0, onMouseDown(event) { diff --git a/shared/src/css/carousel.css b/shared/src/css/carousel.css index b7dc3ee951..bae39aa1f6 100644 --- a/shared/src/css/carousel.css +++ b/shared/src/css/carousel.css @@ -11,6 +11,11 @@ display: grid; scrollbar-width: none; aspect-ratio: 3 / 2; + visibility: hidden; +} + +[data-scope="carousel"][data-part="item-group"][data-loaded] { + visibility: visible; } [data-scope="carousel"][data-part="item-group"][data-orientation="horizontal"] {