isScrolling = false, 50)"
role="navigation"
x-data="{
hasOverflow: false,
checkOverflow() {
const tabs = document.querySelector('.category-tabs');
if (tabs) {
const newValue = tabs.scrollWidth > tabs.clientWidth;
if (newValue !== this.hasOverflow) {
this.hasOverflow = newValue;
}
}
}
}"
x-init="
$nextTick(() => {
checkOverflow();
// Set up mutation observer to watch for changes in category-tabs
const observer = new MutationObserver((mutations) => {
$nextTick(() => {
checkOverflow();
// Double check after a small delay
setTimeout(() => {
checkOverflow();
$nextTick(() => checkOverflow());
}, 100);
});
});
const tabs = document.querySelector('.category-tabs');
if (tabs) {
observer.observe(tabs, {
childList: true,
subtree: true,
attributes: true
});
}
});
window.addEventListener('resize', () => {
checkOverflow();
$nextTick(() => checkOverflow());
});
"
>