Fix mode search filtering and make Enter pick the first match

The .ch-hidden hide rule was overridden by .ch-card's display: flex,
which has equal specificity but appears later in the stylesheet, so
search never visually filtered the mode grid. Mark the hide rule
!important. Enter in the search box now selects the first visible
mode card.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
algometrix 2026-07-18 18:08:08 -04:00
parent 5bab6531ff
commit 768e17acea
2 changed files with 11 additions and 2 deletions

View file

@ -35,7 +35,14 @@ export function createModeGrid(
card.addEventListener("click", () => onCardClick(mode, card));
}
search.addEventListener("keydown", (e) => { e.stopPropagation(); });
search.addEventListener("keydown", (e) => {
e.stopPropagation();
if (e.key === "Enter") {
e.preventDefault();
const firstVisible = cards.find(c => !c.el.hasClass("ch-hidden"));
firstVisible?.el.click();
}
});
search.addEventListener("input", () => {
const q = search.value.toLowerCase();
for (const c of cards) {

View file

@ -44,8 +44,10 @@
margin-bottom: 10px;
}
/* !important so this wins over .ch-card's display: flex, which has equal
specificity but appears later in the sheet. */
.ch-hidden {
display: none;
display: none !important;
}
/* ─── Mode picker grid ─────────────────────────────────────────── */