Skip to content

Settings: a short way by keyboard, and one look for the focus (stacked on #1330) - #1333

Closed
nledford wants to merge 16 commits into
storytold:mainfrom
nledford:settings-keyboard
Closed

nledford wants to merge 16 commits into
storytold:mainfrom
nledford:settings-keyboard

Conversation

@nledford

@nledford nledford commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1330 (and through it on #1326, #1321, #1309, #1299, #1289, #1287): only the last two commits are new here.

Rebased onto main after integration batch 35 (#1682) on 2026-10-14, with the PRs under it. These commits applied without conflict.

What was wrong

  • A long way by keyboard. Tab stopped at each of the nine tabs and then at each of the ten languages: 23 presses from the filter to General's first checkbox.
  • Four looks for "the focus is here". A tab or a choice had a 2 pt ring in the text colour; a checkbox, button or list a thin line of another colour; a text box an accent outline; a radio button a thin circle.
  • A control the keyboard could not reach. The star that makes a theme a favourite was only there under the mouse, unless the theme was a favourite already.

What changes

Tab pressed 4 times before and after, and 23 times before

Top: Tab pressed four times from the filter, before (the fourth tab) and after (General's first checkbox). Bottom: before, the same checkbox after 23 presses, with the focus look a checkbox had. Headless renders of the demo library.

  • One Tab stop per row (widgets::Roving): the tab bar, at the open tab, and each row of choices, at the one that holds. The arrow keys move inside (→ ↓ next, ← ↑ the one before, Home and End to the ends, no wrapping round) and choose nothing: Space or Return does. Tab and Shift+Tab leave the row from wherever in it the focus is.
  • One look for the focus: 2 pt in the text colour round whatever has it. Checkboxes and the theme cards' radio buttons are ringed round box and label; buttons, closed lists and text boxes take it through the window's style (legible_controls).
  • A theme's star is always a Tab stop, drawn while the theme is a favourite, under the mouse or has the focus.

No new sentences: nothing for the catalogs.

Limits

  • The style that rings a focused button is also what egui draws while a button is pressed: a press with the mouse shows the ring for as long as it lasts. A click leaves none.
  • The list that opens from a closed list (Raw defaults, Metadata presets) keeps the theme's look.
  • selection.stroke also colours selected text in a text box of Settings: now the text colour on the selection's fill.
  • Only Settings: Export's rows of choices are one Tab stop a button still.
  • A theme's radio buttons are one stop each, not one for the card.
  • In a row that wraps onto several lines, ↑ and ↓ are "the one before" and "the next", not "the line above".
  • A screen reader can press a choice that is not the row's stop but cannot move the focus to it; egui has no tab role, so a tab is still announced as a button that says whether it is chosen.
  • Heights are unchanged (buttons 22 pt, text boxes 20): changing them moves every dialog's layout, which Print module: picture and custom packages, printer colour management, colour-managed PDF (gap 15) #1215 and others measure.

With the other pull requests

widgets.rs gets Roving, choice_button_in and tab_button_in beside the existing functions, whose signatures stay; settings::choices and row keep theirs. Trial merges against the 55 open pull requests show no conflict that #1330 does not already have.

Verification

  • Scenarios written first (tests_dialog_settings_keys.rs, 9): four presses to the first checkbox and back; the stop is the choice that holds; arrows, Home and End along the tabs, Space opening one; the same in a row of choices, Return, and arrows with ⌘ or ⇧ left alone; arrows arriving a frame apart staying in the row; a click choosing and leaving no ring; every kind of control ringed in every theme; a section found ringed; the star reached, drawn, ringed and pressed, and the radio button before it ringed. Three older tests in tests_dialog_settings_tabs.rs press an arrow where they pressed Tab.
  • An independent review found no blocker and, by mutation, ten of twelve behaviours caught by a test. Fixed in the second commit, tests first: an arrow on the frame after the focus moved could leave the row for the tab bar; a click on a tab or choice left it ringed; arrows with a modifier moved the focus; a theme's radio button was not ringed as a checkbox is; the star's icon when it has the focus had no test. A second reviewer checked that commit: each of the five fixes is caught by a test when it is taken out, Tab and Shift+Tab still leave a row on the frame after an arrow moved the focus, and a click leaves the focus where it did before this pull request (nowhere). It found nothing to fix; left untested, by its account: Tab on the very frame after an arrow (it works), Return on a tab, and arrows with Alt or Ctrl.
  • After the rebase: fmt, clippy for the UI crate, parity, layers and assets pass. The UI crate's tests were not run on this branch itself after the rebase (no source conflict here); they were run on LR-PREF-GENERAL: the Settings window is one size on every tab, and nothing in it runs off the side #1287 (850 pass; the six tests_model_setup tests fail, as on main under cargo test -p lightcraft-ui-egui) and on LR-PREF-INTERFACE: text sizes have names, the seven type roles of the theme #1374, which holds this branch (939 pass, the same six fail). The wasm check was not run after the rebase.
  • The desktop app was not run; looked at in headless screenshots.

🤖 Generated with Claude Code

nledford and others added 16 commits October 14, 2026 07:28
…thing in it runs off the side

General was 970 pt wide and the other tabs about 600, because a row of
controls never wrapped and the widest row set the window's width; the
window was also as tall as each tab's content, so it moved up and down
between tabs and the tabs moved under the pointer. In a 900 pt wide app
window the row labels and the Close button of General were off screen at
the left, and a long library path made the window wider than the screen.

- settings::window draws the tab bar, which stays put, above the page of the
  open tab, which scrolls: 560 pt wide and up to 640 pt tall whatever the
  page holds, less when the app window is smaller. Each page keeps a scroll
  position of its own, and one that goes on below shows its scroll handle
  without the pointer on it. It is still drawn in the scroll area every
  dialog has, which has nothing to scroll; in a window with under 120 pt for
  the page (far below the desktop minimum) that area scrolls tabs and page
  together, as before.
- A row's controls wrap in the room beside the label, further lines starting
  under the first control, and a label longer than its column wraps in it
  (Forget unchanged photos pushed its choices 8 pt out of line).
- Paths are one line, shortened from the front after either kind of
  separator, with all of the path in a tooltip only when it was cut: Library
  > Location, the folder Auto Import watches (it wrapped over several lines),
  the smart previews folder (it lost its end, and had two tooltips) and a
  monitor profile's file.

row(), choices() and TABS keep their signatures, the match on the tab is
where it was and the shared dialog code changes by one call, so the open
pull requests that add tabs and rows still merge. Below 640 pt of app
window a row holding a 240 pt field can still be wider than the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ore reading it

The row is at the foot of Import. With more sections above it (another
pull request adds one) it is below the fold of the 640 pt page, and a row
that is not drawn has no text to read: the test failed for the page's
length, not for the path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… or has the focus shows

One widget drew the tab bar and every row of choices: on General the
languages read as a second tab bar. What was chosen differed from what was
not by its fill alone, 1.35 to 1.56:1 in the four themes, and a tab or choice
reached with Tab showed nothing (the frame with and without the focus was
the same, pixel for pixel).

- widgets::tab_button: a tab is its name on the window, a size up from the
  headings inside a page, the open one in the text colour over a 2 pt line
  of that colour; no border, no fill. Each line of tabs stands on a 1 pt
  line the width of the window, so the open tab's line never hangs over the
  names below when the tabs take two lines (a narrow window, or Russian at
  full width).
- widgets::choice_button, used by settings::choices: the chosen option keeps
  its fill and is outlined in the label colour (5.5:1 or more against its
  fill, a button and the window in every theme), and is a radio button to a
  screen reader. The Export dialog's own rows of choices are as they were.
- Both, and text_button wherever it is used, show a ring while they have the
  keyboard focus: 2 pt in the text colour with a 1 pt line of the surface's
  colour inside it, within their rect. A double line, where a chosen option
  has a single thin one, so the two are told apart by shape. Tab, the arrow
  keys, Space and Return already worked.

Widget ids are as they were (button:settingsTab-{id}, button:{id}-{index}).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Esc in its text boxes gives the text back

- Clear Cache and a model's Remove (Faces, AI Denoise) open a small panel
  under the button that says what the action costs, with the action and Keep
  (settings::ask_first; {id}:confirm, {id}:keep). Keep has the focus, so
  Return alone changes nothing; Esc or a click elsewhere answers no. They
  acted on one click: a cache that takes hours to make again in a large
  library, a model that is a 261 MB download.
- Smart previews: "Delete them" was a choice made beforehand that a later
  press of Choose Folder or Use Library Folder carried out without a word.
  The change now waits, says how many smart previews would go and what they
  are for, and is made on Delete and Change Folder or dropped on Cancel. The
  choice and a waiting change are kept from one frame of the section to the
  next only, for the library and folder they were made in (SmartAsk): closing
  Settings, another tab, another library, or the folder changed some other
  way leaves nothing chosen or asked, and the choice goes back to "Move
  them" after any change.
- The text boxes of Settings go through settings::field: Esc gives the text
  back and is used up by that, so Settings stays open. Copyright, Creator and
  the Auto Import album become the project's TextField; Esc there used to
  save what was typed (the box lost the focus) and close the window.
- A tab clicked opens on the next frame, so the page being left is drawn
  once more and Copyright or Creator saves what was typed; it was dropped.
- The album box keeps its text per library (one library's album name could
  be written into another's).
- Automatically write changes into XMP sidecars has a line saying what is
  written where.

The lines that run the commands (let _ = app.run(..)) and the ones next to
them are as they were: storytold#1153's sweep of those lines still applies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to do

General held the library's location beside the language and the external
editors; XMP sidecar writing, which governs every later edit, sat under
Import; forgetting unchanged photos and the smart previews folder, which
are the library's own, under Performance. "Display" was the monitor's
colour profile and "Interface" how LightCraft looks.

- Library (new, `library`): where the library is, opening or making
  another, where its smart previews are kept, and Local folders.
- Files (new, `files`): XMP sidecars and External Editing.
- General keeps Language, Startup and Culling; Import keeps what happens to
  photos as they come in; Performance keeps Rendering and Thumbnail cache.
- Display is labelled Monitor and Interface is labelled Appearance
  (settings::tab_label). Their ids, and every other tab id, are as they
  were: `app.settings {tab}` from agents, scripts and the rest of the app
  opens what it opened.
- What is saved with the library says, in a library that is in memory, that
  it will not last, on each tab that holds such settings.
- A section's heading is registered as `heading:{its English name}`
  whatever the language (i18n::source_of).
- Files and Monitor are in the nine catalogs.

No section's code moved. The tab functions are split where their sections
begin by inserting the end of one function and the start of the next, and
the tabs call the sections: the lines other open pull requests change are
where they were. Controls keep their widget ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… they click it

Library is a long page once it also holds Backups (another pull request):
the smart previews buttons are then below the fold of the 640 pt page, where
a control is not drawn and a click on its place goes nowhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er tab it is

Finding a setting meant knowing or guessing its tab, and reading each of
nine.

- A filter box (field:settingsFilter) is above the tabs. With something
  typed, the page gives way to the sections that have every word typed, each
  a row with its tab and heading and the first texts of it that match
  (settingsFound:{tab}:{section}); no tab is marked open meanwhile.
- A click on a row, Return or Space with the focus on it, or Return in the
  filter (the first row) opens that section's tab, empties the filter and
  scrolls the section's heading to the top of the page. Down in the filter
  goes to the first row.
- Esc with something typed empties the filter and is used up by that,
  whether the focus is in the box or on a row; a second Esc closes Settings.
  Opening a tab empties it; Settings opened again starts empty.
- What is looked through is read, not kept by hand: every tab's page is
  drawn once in an egui context of its own (settings::sections), and each
  text drawn belongs to the heading above it. Tab and section names, labels,
  buttons and explanations are all there, in the language shown, and
  whatever another change adds to a page is found without a word here. It is
  read afresh each time the filter is used, so what is found is what the
  pages show then. Nothing of that drawing reaches the screen, the widget
  list or the window's own memory; it asks what opening each tab asks and
  changes no setting. The choices of a closed list and tooltips are not
  drawn, so not found.
- The three new sentences are in the nine catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…section has

"sidecar" is also in the Read from photos section another pull request adds
to Import, so the tests look for "sidecar names" and a sentence of the XMP
hint. The test of a page's remembered scroll reads where the glide comes to
rest: on a longer page it was still under way when read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sections

Another pull request adds a section to Appearance: the test says every
section found is on that tab, and that one which does not say the word
itself is among them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n every language it has

- Tokens::legible gives a colour as it is where it stands the ratio asked
  for against the surface it is on, and moved toward the text colour until
  it does where a theme's value is too close. Settings uses it for its
  explanations (4.20:1 in Charcoal, 4.33:1 in Silver), what the filter
  found, "In Use" and the outline of the theme card in use (2.9:1 and
  2.6:1 in Charcoal), the caution and reject colours as text, and the dim
  text, cautions and accent of the AI Denoise page: text stands 4.5:1.
- settings::legible_controls does the same for what says where a control is,
  in the window and in the panel a question opens: the borders of text
  boxes, checkboxes, radio buttons and buttons (1.6 to 1.7:1), a text box in
  use, and placeholder text (under 4.3:1 in every theme). A choice that is
  not the chosen one has the same border (widgets::choice_button), and the
  line under the tabs (1.2 to 1.4:1) stands 3:1.
- A colour that read already is unchanged, and the tokens keep their values
  for the rest of the app.
- The hint under External Editing had a menu path with an arrow the fonts
  lack, which drew as empty boxes; it uses ">".
- 27 names and sentences of Settings that no catalog had are in all nine,
  with the three menu items that hint names (Edit In, Edit in PhotoCraft,
  Edit in Other Editor); "memory only", "(library default)" and
  "starting…" go through translation.

The Faces page's model rows keep their colours and their strings that bypass
translation: storytold#1190 changes those lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st, and shows why

Either spelling of a word finds the other, and words a section does not say find it (trash
for Culling). A section named for the word comes before one that mentions it, so Return
opens the best match. The line under a result starts shortly before the word found, which
is drawn stronger; folder paths are not looked through. The filter has the focus when
Settings opens, and the heading of the section opened is marked for a moment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… either spelling

"colou", on the way to "colour", found nothing once texts were compared as "color": a
word now counts as typed or in the other spelling. What is typed into a text box of
Settings (an editor's path) is not looked through, and what stands in words where a folder
would ("In memory") is again. The mark on the section landed on goes when its tab is left,
however that is done. The words given to sections are tested against the sections drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he whole word does

"colou" found only the texts that say "colour", not those that say "color" or the
sections given it, and "catalogu" found nothing: past where the two spellings part, a
word still being typed is compared as the one the filter compares in. The release note
says that an empty text box's own words are not looked through either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…der it, and the word is drawn whole

The line under a result was cut into pieces at the letters found, each piece in
a format of its own (dimmer text, the letters found in the text colour and a
heavier weight). epaint shapes each piece by itself, so a match inside a word
lost the kerning across the cuts, and in Arabic left the letters either side of
them unjoined.

The line is now one piece of text in one format. The letters found have a fill
behind them and a line under them, a rectangle per stretch per row, placed from
the galley's glyphs (a word written from right to left has its glyphs back to
front, and is read by the char each glyph says it draws). The line under them is
there because the heavier weight is gone: the fill alone would be told by its
colour only. The line of text is in one colour, legible on the fill too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or the focus

Tab stops once at the tab bar and once at each row of choices, at the one that is open or
holds; the arrow keys, Home and End move inside (widgets::Roving). A checkbox, button, list,
radio button or text box that has the focus is ringed 2 pt in the text colour, as a tab or a
choice is. A theme's favourite star is a Tab stop whether or not the theme is a favourite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… row of Settings

On the frame the focus came to a button of a row, egui had no filter for it yet and looked
for the nearest control in the arrow's direction: a second arrow on the next frame could
leave the row for the tab bar. A click on a tab or a choice no longer leaves it ringed as
if the keyboard had come to it, an arrow held with a modifier is left alone, and a theme's
radio button with the focus is ringed round the whole of it, as a checkbox is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nledford

Copy link
Copy Markdown
Contributor Author

Folded into #1287, which now holds this PR's commits together with the rest of its chain, rebased onto current main (0da998f2). The description there covers every step, links back here, and has fresh screenshots. This PR's description and discussion stay here for reference.

@nledford nledford closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant