Files
hermes-webui/tests/test_2791_model_picker_keyboard_nav.py
T
de4509702d Release v0.51.337 — Release LA (model-picker keyboard nav #2952 + mobile new-chat #3531) (#3857)
Two small, aesthetic-safe UX wins:
- #2952 (@Sanjays2402): model-picker arrow-key navigation + Enter-to-select.
  Highlight reuses existing hover style, invisible until keyboard used.
  Opus SHIP-safe, live key-drive verified (multi-row traversal + wrap + Enter).
- #3531 (@franksong2702): mobile titlebar '+' new-chat button. Shares the
  existing reload-button styling, mobile-only, mirrors new-chat pending state.
  390px screenshot vision-verified: cleanly aligned in the titlebar.

Both rebased onto master (CHANGELOG-only / merge-commit conflicts resolved;
code verified byte-identical to PR heads). Full suite green on each (8336/8334),
ESLint/scope-undef CLEAN, zero blocking bot flags.

Co-authored-by: Sanjays2402 <Sanjays2402@users.noreply.github.com>
Co-authored-by: franksong2702 <franksong2702@users.noreply.github.com>
2026-06-08 18:47:55 -07:00

34 lines
1.1 KiB
Python

"""Regression check for #2791 — keyboard navigation in the model picker.
The picker is a click-driven dropdown; users asked for arrow-key navigation
and Enter-to-select on the existing search input. Verified at the source
level so this stays fast.
"""
from pathlib import Path
REPO = Path(__file__).parent.parent
UI_JS = (REPO / "static" / "ui.js").read_text(encoding="utf-8")
STYLE_CSS = (REPO / "static" / "style.css").read_text(encoding="utf-8")
def test_arrow_keys_wired_on_search_input():
# ArrowDown / ArrowUp / Enter all handled in one keydown listener on _si.
assert "ArrowDown" in UI_JS
assert "ArrowUp" in UI_JS
assert "is-highlighted" in UI_JS
def test_highlight_class_has_style():
assert ".model-opt.is-highlighted" in STYLE_CSS
def test_escape_still_closes_dropdown():
# Existing Escape-to-close behavior must not regress.
assert "if(e.key==='Escape'){closeModelDropdown();return;}" in UI_JS
def test_enter_picks_highlighted_row():
# Enter should call .click() on the highlighted (or first) row.
snippet = UI_JS[UI_JS.index("ArrowDown"):]
assert "pick.click()" in snippet