Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.35.2 (5/20/2025, 14:21:47)
* Chimera UI Libraries - Build 0.35.3 (5/28/2025, 20:39:27)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -44516,8 +44516,7 @@ function CardsCarousel() {
}

function shouldHideNextButton() {
var carousel = carouselRef.current;
var atEndOfCarousel = carousel.scrollWidth - carousel.clientWidth < carousel.scrollLeft + cardWidth;
var atEndOfCarousel = firstVisibleCard >= cards.length - cardsPerPage;
if (atEndOfCarousel) {
hideNextButton();
if (userIsTabbing()) {
Expand Down Expand Up @@ -44560,7 +44559,6 @@ function CardsCarousel() {
if (!cardLinks.length) return;
cardLinks.forEach(function (link) {
link.setAttribute('aria-hidden', 'true');
link.setAttribute('inert', '');
link.setAttribute('tabindex', '-1');
});

Expand All @@ -44569,19 +44567,16 @@ function CardsCarousel() {
var linkBlockers = card.querySelectorAll('.consonant-LinkBlocker');
linkBlockers.forEach(function (link) {
link.removeAttribute('aria-hidden');
link.removeAttribute('inert');
link.setAttribute('tabindex', '0');
});
var modalVideo = card.querySelector('.consonant-Card-videoIco');
if (modalVideo) {
modalVideo.removeAttribute('aria-hidden');
modalVideo.removeAttribute('inert');
modalVideo.setAttribute('tabindex', '0');
}
} else {
cardLinks.forEach(function (link) {
link.removeAttribute('aria-hidden');
link.removeAttribute('inert');
link.setAttribute('tabindex', '0');
});
}
Expand Down
4 changes: 2 additions & 2 deletions dist/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/main.source.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ function CardsCarousel({
}

function shouldHideNextButton() {
const carousel = carouselRef.current;
const atEndOfCarousel =
(carousel.scrollWidth - carousel.clientWidth < carousel.scrollLeft + cardWidth);
const atEndOfCarousel = firstVisibleCard >= cards.length - cardsPerPage;
if (atEndOfCarousel) {
hideNextButton();
if (userIsTabbing()) {
Expand Down Expand Up @@ -208,7 +206,6 @@ function CardsCarousel({
if (!cardLinks.length) return;
cardLinks.forEach((link) => {
link.setAttribute('aria-hidden', 'true');
link.setAttribute('inert', '');
link.setAttribute('tabindex', '-1');
});

Expand All @@ -217,19 +214,16 @@ function CardsCarousel({
const linkBlockers = card.querySelectorAll('.consonant-LinkBlocker');
linkBlockers.forEach((link) => {
link.removeAttribute('aria-hidden');
link.removeAttribute('inert');
link.setAttribute('tabindex', '0');
});
const modalVideo = card.querySelector('.consonant-Card-videoIco');
if (modalVideo) {
modalVideo.removeAttribute('aria-hidden');
modalVideo.removeAttribute('inert');
modalVideo.setAttribute('tabindex', '0');
}
} else {
cardLinks.forEach((link) => {
link.removeAttribute('aria-hidden');
link.removeAttribute('inert');
link.setAttribute('tabindex', '0');
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('CardsCarousel comprehensive behaviors', () => {
const nextBtn = c.querySelector('[name="next"]');
const prevBtn = c.querySelector('[name="previous"]');
expect(prevBtn).toHaveClass('hide');
expect(nextBtn).toHaveClass('hide');
expect(nextBtn).not.toHaveClass('hide');
});

test('desktop: nav buttons visible and grid renders all cards', async () => {
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('CardsCarousel comprehensive behaviors', () => {
Object.defineProperty(carousel, 'clientWidth', { value: 200, writable: true });
fireEvent.scroll(carousel);
const nextBtn = c.querySelector('[name="next"]');
expect(nextBtn).toHaveClass('hide');
expect(nextBtn).not.toHaveClass('hide');
});

test('responsive: resizing toggles nav visibility', async () => {
Expand All @@ -135,7 +135,7 @@ describe('CardsCarousel comprehensive behaviors', () => {
});
const nextBtn = c.querySelector('[name="next"]');
const prevBtn = c.querySelector('[name="previous"]');
expect(nextBtn).toHaveClass('hide');
expect(nextBtn).not.toHaveClass('hide');
expect(prevBtn).toHaveClass('hide');
});

Expand All @@ -159,11 +159,9 @@ describe('CardsCarousel comprehensive behaviors', () => {
if (idx < 3) {
expect(link.getAttribute('tabindex')).toBe('0');
expect(link.hasAttribute('aria-hidden')).toBe(false);
expect(link.hasAttribute('inert')).toBe(false);
} else {
expect(link.getAttribute('tabindex')).toBe('-1');
expect(link.hasAttribute('aria-hidden')).toBe(true);
expect(link.hasAttribute('inert')).toBe(true);
}
});
});
Expand Down Expand Up @@ -213,7 +211,7 @@ describe('CardsCarousel comprehensive behaviors', () => {
Object.defineProperty(carousel, 'clientWidth', { value: 1000, writable: true });
fireEvent.scroll(carousel);
const nextBtn = c.querySelector('[name="next"]');
expect(nextBtn).toHaveClass('hide');
expect(nextBtn).not.toHaveClass('hide');
});

test('getCardWidth: tests all layout types and gaps', () => {
Expand Down Expand Up @@ -255,14 +253,12 @@ describe('CardsCarousel comprehensive behaviors', () => {
for (let i = 0; i < 3; i++) {
expect(links[i].getAttribute('tabindex')).toBe('0');
expect(links[i].getAttribute('aria-hidden')).toBeNull();
expect(links[i].getAttribute('inert')).toBe(null);
}

// Initial state: last three links should not be accessible
for (let i = 3; i < 6; i++) {
expect(links[i].getAttribute('tabindex')).toBe('-1');
expect(links[i].getAttribute('aria-hidden')).toBe('true');
expect(links[i].getAttribute('inert')).toBe('');
}

// Click next button
Expand All @@ -275,13 +271,11 @@ describe('CardsCarousel comprehensive behaviors', () => {
for (let i = 0; i < 3; i++) {
expect(links[i].getAttribute('tabindex')).toBe('-1');
expect(links[i].getAttribute('aria-hidden')).toBe('true');
expect(links[i].getAttribute('inert')).toBe("");
}

for (let i = 3; i < 6; i++) {
expect(links[i].getAttribute('tabindex')).toBe('0');
expect(links[i].getAttribute('aria-hidden')).toBe(null);
expect(links[i].getAttribute('inert')).toBe(null);
}
});

Expand All @@ -302,11 +296,26 @@ describe('CardsCarousel comprehensive behaviors', () => {
fireEvent.click(container.querySelector('[name="previous"]'));
expect(carousel.scrollLeft).toBe(initialScroll);
});

test('desktop keyboard navigation focus: setFocusNextBtn and setFocusPrevBtn focus buttons when tabbing', async () => {
document.body.classList.add('tabbing');
const c = await setupCarousel(1400);
const prevBtn = c.querySelector('[name="previous"]');
const nextBtn = c.querySelector('[name="next"]');
// After initial mount in tabbing mode, focus should end on prev button
expect(document.activeElement).toBe(nextBtn);
});

test('shouldHideNextButton calls setFocusPrevBtn when tabbing and at end of carousel', async () => {
document.body.classList.add('tabbing');
const c = await setupCarousel(1400);

// Scroll to the end
const nextBtn = c.querySelector('[name="next"]');
while (!nextBtn.classList.contains('hide')) {
fireEvent.click(nextBtn);
}

const prevBtn = c.querySelector('[name="previous"]');
expect(document.activeElement).toBe(prevBtn);
});
});
Loading