Skip to content

feat: Implement Material 3 image carousel component#113

Draft
treeder wants to merge 1 commit into
mainfrom
jules-carousel-component-15702534854147387189
Draft

feat: Implement Material 3 image carousel component#113
treeder wants to merge 1 commit into
mainfrom
jules-carousel-component-15702534854147387189

Conversation

@treeder
Copy link
Copy Markdown
Member

@treeder treeder commented May 12, 2026

Implemented the Material 3 image carousel component with dynamic item resizing using modern CSS.


PR created automatically by Jules for task 15702534854147387189 started by @treeder

Added `md-carousel` and `md-carousel-item` components based on Material 3 specifications.
The implementation uses CSS Scroll Snap for horizontal scrolling and modern CSS Scroll-driven
Animations (`animation-timeline: view(inline)`) to achieve the dynamic item resizing (large
in the center, shrinking at the edges) characteristic of the M3 multi-browse design, ensuring
high performance without heavy JavaScript computations. Components have correct ARIA roles
and export configurations.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Carousel component, consisting of Carousel and CarouselItem custom elements, and integrates them into the project's main entry points. The implementation leverages Lit and CSS Scroll-driven Animations for dynamic item resizing. Review feedback focuses on improving accessibility by removing a hardcoded aria-label, ensuring cross-browser compatibility for animations by adding a duration to the shorthand property, and unifying CSS variable names for better maintainability.

Comment thread carousel/carousel.js

render() {
return html`
<div class="carousel" aria-label="carousel">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The aria-label="carousel" is a hardcoded string, which is problematic for internationalization. Additionally, aria-label should generally not be used on a div without a semantic role (like region or list), as it may be ignored by assistive technologies. Since the host element already has role="list", any descriptive label should be provided by the consumer on the host element itself.

Suggested change
<div class="carousel" aria-label="carousel">
<div class="carousel">

Comment thread carousel/carousel.js
scroll-snap-align: start;

/* M3 dynamic item sizing using CSS Scroll-driven Animations */
animation: material-carousel-item-resize linear both;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The animation shorthand is missing a duration. While animation-timeline is used to drive the progress, many browsers still require a non-zero duration (or the auto keyword) for the animation to be considered active and to function correctly across different implementations of the Scroll-driven Animations spec.

Suggested change
animation: material-carousel-item-resize linear both;
animation: material-carousel-item-resize auto linear both;

Comment thread carousel/carousel.js
Comment on lines +54 to +59
15% {
width: var(--md-carousel-large-width, 240px);
}
85% {
width: var(--md-carousel-large-width, 240px);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variable name --md-carousel-large-width is inconsistent with --md-carousel-item-width used in carousel-item.js. Using a single variable for the item's standard width improves maintainability and ensures that customizations to the item size are correctly reflected in the carousel's dynamic resizing animation.

Suggested change
15% {
width: var(--md-carousel-large-width, 240px);
}
85% {
width: var(--md-carousel-large-width, 240px);
}
15% {
width: var(--md-carousel-item-width, 240px);
}
85% {
width: var(--md-carousel-item-width, 240px);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant