fix: filebrowser scroll+lang hover+black-flash+shell one-line
- filebrowser: select() only scrollIntoView on keyboard, not hover - lang-switch: .lang-switch:hover → invert rule (header excluded before) - black-flash: color-scheme light; dark script sets colorScheme - shell: flex-wrap nowrap; keepEnd() scrolls on input Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
if (img.complete) img.style.opacity = "1"; // already cached → no fade
|
||||
}
|
||||
|
||||
function select(i, silent) {
|
||||
function select(i, silent, scroll) {
|
||||
if (!rows.length) return;
|
||||
if (i < 0) i = 0;
|
||||
if (i >= rows.length) i = rows.length - 1;
|
||||
@@ -39,7 +39,9 @@
|
||||
for (var r = 0; r < rows.length; r++) rows[r].classList.remove("is-selected");
|
||||
var a = rows[i];
|
||||
a.classList.add("is-selected");
|
||||
if (a.scrollIntoView) a.scrollIntoView({ block: "nearest" });
|
||||
// only scroll for keyboard nav — scrolling on hover nudges edge rows out from
|
||||
// under the cursor, so the top/bottom row "sometimes" can't be clicked.
|
||||
if (scroll && a.scrollIntoView) a.scrollIntoView({ block: "nearest" });
|
||||
|
||||
var src = a.getAttribute("data-img");
|
||||
var tkey = a.getAttribute("data-text");
|
||||
@@ -100,8 +102,8 @@
|
||||
var t = e.target;
|
||||
if (t && (t.isContentEditable || /^(input|textarea|select)$/i.test(t.tagName))) return;
|
||||
if (!rows.length) return;
|
||||
if (e.key === "ArrowDown") { e.preventDefault(); select(cur + 1); }
|
||||
else if (e.key === "ArrowUp") { e.preventDefault(); select(cur - 1); }
|
||||
if (e.key === "ArrowDown") { e.preventDefault(); select(cur + 1, false, true); }
|
||||
else if (e.key === "ArrowUp") { e.preventDefault(); select(cur - 1, false, true); }
|
||||
else if (e.key === "Enter") {
|
||||
var href = rows[cur] && rows[cur].getAttribute("href");
|
||||
if (href) { if (window.pjax) window.pjax(href); else window.location.href = href; }
|
||||
|
||||
Reference in New Issue
Block a user