theme overlay keeps its size across the favourites filter, f flips the filter

This commit is contained in:
2026-08-25 17:10:47 +00:00
parent d0f83b58c9
commit d3deca0d08
8 changed files with 20 additions and 22 deletions
+7 -11
View File
@@ -21,7 +21,9 @@ import type { ThemeId } from './themes';
* action invited the guess that `ctrl+shift+j` moved down — which opens the browser console instead. One
* spelling, no guessing.
*
* Inside the list `f` stars or unstars what is FOCUSED, so a browse and a shortlist are one pass.
* Inside the list `f` flips the favourites-only filter. It used to star what was focused, but starring
* already has a chord (`ctrl+shift+f`, and `l` applies the focused theme first when it is not the one
* worn), so the single letter goes to the thing that had none.
*
* Inside the list the vim keys stay, UNMODIFIED — `j`/`k`/`l`/`h` alongside the arrows. No modifier means
* no collision with anything the browser owns, and this is a vim person's application.
@@ -39,7 +41,7 @@ import type { ThemeId } from './themes';
* Browsing walks `browseOrder` — the list as DISPLAYED — not the registry. The two orders must be the
* same list or the focus visibly jumps, which is exactly what happened when the overlay lifted
* favourites to a top block while stepping walked registry order. The overlay now shows one plain
* rotation and `tab` flips a favourites-only filter (`onToggleFilter`); either way, what you see is
* rotation and `f` flips a favourites-only filter (`onToggleFilter`); either way, what you see is
* what `j`/`k` walk.
*
* ── Not a UI ──
@@ -49,7 +51,7 @@ import type { ThemeId } from './themes';
*/
type ThemeKeysOptions = {
/**
* Star or unstar the focused theme — bound to `f` while the list is open.
* Star or unstar the CURRENT theme — bound to `ctrl+shift+f`, from anywhere.
*
* Passed in rather than owned here: favourites are per ACCOUNT and live behind an API, which is app
* knowledge. This hook owns keys and selection and nothing else.
@@ -60,7 +62,7 @@ type ThemeKeysOptions = {
* browse falls back to the full registry rotation.
*/
browseOrder?: readonly ThemeId[];
/** Flip the favourites-only filter — bound to `tab` while the list is open. App state, like the stars. */
/** Flip the favourites-only filter — bound to `f` while the list is open. App state, like the stars. */
onToggleFilter?: () => void;
};
@@ -187,13 +189,7 @@ export function useThemeKeys(options: ThemeKeysOptions = {}) {
switch (event.key) {
case 'f':
case 'F':
// Star or unstar what is focused, without moving or applying it.
event.preventDefault();
onToggleFavorite.current?.(focus);
return;
case 'Tab':
// Favourites only ↔ everything. preventDefault or the browser also moves focus, and the
// overlay has nothing focusable to move it to.
// Favourites only ↔ everything. Starring is `ctrl+shift+f`, handled above before this switch.
event.preventDefault();
onToggleFilter.current?.();
return;