Skip to content

A live bird collage card for your Home Assistant dashboard.

Fix view carousel sliding direction when UI is RTL (#89)

Yo'av Moshe72d3c3e00612
diff --git a/dist/habird-card.js b/dist/habird-card.js
index cc223039..0e606536 100644
--- a/dist/habird-card.js
+++ b/dist/habird-card.js
@@ -3700,7 +3700,7 @@ function runHABirdApp(__root, __shell, __cardConfig, __imgBase) {
// Stats + atlas drop the shared title so their content gets the full height.
__shell.classList.toggle('av-view-stats', i === 1);
__shell.classList.toggle('av-view-atlas', i === 2);
- views.style.transform = 'translateX(-' + (i * 100) + '%)';
+ views.style.transform = 'translateX(' + (getComputedStyle(views).direction === 'rtl' ? '' : '-') + (i * 100) + '%)';
btns.forEach(function (b, j) { b.setAttribute('aria-current', j === i ? 'true' : 'false'); });
syncPill(slider);
setTitleForView(i);
diff --git a/homeassistant/www/apt.js b/homeassistant/www/apt.js
index 0b976d10..743321cf 100644
--- a/homeassistant/www/apt.js
+++ b/homeassistant/www/apt.js
@@ -1497,7 +1497,7 @@
// Stats + atlas drop the shared title so their content gets the full height.
document.body.classList.toggle('av-view-stats', i === 1);
document.body.classList.toggle('av-view-atlas', i === 2);
- views.style.transform = 'translateX(-' + (i * 100) + '%)';
+ views.style.transform = 'translateX(' + (getComputedStyle(views).direction === 'rtl' ? '' : '-') + (i * 100) + '%)';
btns.forEach(function (b, j) { b.setAttribute('aria-current', j === i ? 'true' : 'false'); });
syncPill(slider);
setTitleForView(i);