Keep rail icons in place and move only the highlight

The left rail no longer lifts its open icon out beside the panel title or
reorders the rest behind it. Every icon keeps its place, open or not, and
the rail's shared highlight slides to the open one, on both rails.

The rail also holds one height whichever panel is open: its offset now
allows for the stack rising by a different amount for a tall panel than at
rest.

Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-14 13:41:07 -08:00
1 parent 59ffa87535
commit b090937e5f
5 files changed
+30 -72

No files matched your search

-16
View File
@@ -62,24 +62,9 @@ export function installRailEdgeScroll(doc = globalThis.document) {
// highlight is showing is kept here, and the classes are put back each time.
const gliding = new WeakSet();
// Where a rail lifts its open item out to sit beside the panel's title, the
// items left in the rail follow on from it in turn, so the next one in line
// is the one directly under it and a step brings that one up. A rail that
// keeps its open item in place keeps its own order.
function reorder(rail, on) {
const slots = [...rail.children].filter((slot) => slot.querySelector?.('.ui-rail__item'));
const at = on ? slots.findIndex((slot) => slot.contains(on)) : -1;
const lifted = at >= 0 && win.getComputedStyle(slots[at]).position === 'absolute';
slots.forEach((slot, index) => {
const order = lifted ? String((index - at + slots.length) % slots.length) : '';
if (slot.style.order !== order) slot.style.order = order;
});
}
function glide(rail) {
rail.classList.toggle('ui-rail--edge-hot', rail === hot);
const on = rail.querySelector('.ui-rail__item[aria-pressed="true"]');
reorder(rail, on);
if (!on?.offsetWidth) {
gliding.delete(rail);
rail.classList.remove('ui-rail--glide');
@@ -263,7 +248,6 @@ export function installRailEdgeScroll(doc = globalThis.document) {
win.removeEventListener('resize', onResize);
doc.querySelectorAll('.ui-rail').forEach((rail) => {
rail.classList.remove('ui-rail--glide', 'ui-rail--glide-jump', 'ui-rail--edge-hot');
reorder(rail, null);
});
};
}