A model menu that stays on the phone
Inside a chat the picker sits mid-bar with the panel buttons to its right, and its menu opened from the picker's right edge -- at 390px it spanned x = -132..226, cutting every model's name off. Below 48rem the bar is now the containing block and the menu is pinned between its edges (capped at 24rem). Opening it on a touchscreen no longer focuses the filter, which raised the keyboard over half the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,3 +111,22 @@ def test_settings_lists_the_models_with_their_tags_below_the_name(client, models
|
||||
assert listing.count("#i-eye") == 1
|
||||
assert listing.count('class="model-list__more model-list__tags"') == 2
|
||||
assert "tool_fetch" in listing
|
||||
|
||||
|
||||
def test_opening_the_picker_on_a_touchscreen_does_not_raise_the_keyboard():
|
||||
"""1.8.3. With more than eight models the menu has a filter, and `open()`
|
||||
focused it -- which on a phone raises the keyboard over half the list the
|
||||
finger came to choose from. The focus is gated on `(hover: none)`, the same
|
||||
query the stylesheet uses for touch."""
|
||||
from pathlib import Path
|
||||
|
||||
import lembas
|
||||
|
||||
js = (Path(lembas.__file__).parent / "web/static/js/ui.js").read_text(encoding="utf-8")
|
||||
start = js.index("function open(picker)")
|
||||
body = js[start : js.index("function applyFilter", start)]
|
||||
assert "filter.focus()" in body, "the filter is no longer focused anywhere -- test is blind"
|
||||
gated = r'if \(filter && !window\.matchMedia\("\(hover: none\)"\)\.matches\)\s*\{'
|
||||
assert re.search(gated + r"\s*filter\.focus\(\)", body), (
|
||||
"the filter is focused on open without asking whether this is a touchscreen"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user