Skip to content

fix(overlay): give the inline panels the same keyboard contract - #557

Merged
DeepDiver1975 merged 1 commit into
mainfrom
feat/538-inline-panel-keyboard
Oct 3, 2026
Merged

DeepDiver1975 merged 1 commit into
mainfrom
feat/538-inline-panel-keyboard

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Fixes #538 (PR B of two; PR A was #555). Part of the v0.8 keyboard epic #545.

What changes

#555 gave the dialogs b:Overlay. The inline panels a module draws in its own XAML never got it: they are shown by IsVisible and never leave the visual tree, which is what the behaviour listens to. None of them took focus, closed on Esc, or gave focus back.

Two new attached properties on b:Overlay (src/LageBuch.App.Shared/Behaviors/Overlay.cs):

Property Effect
IsInline Opens and closes with the panel's own IsVisible. Not modal: focus that leaves for the page beside it is not pulled back, and closing then leaves it there. Arriving at a module by the rail does not count as opening its panel.
FallbackFocus Where focus goes on close when the opener has gone in a rebuild.

Tab cycles inside an open panel, as contract 1 says. Esc, Enter and initial focus work exactly as they do for dialogs.

Panel Esc Enter Initial focus Fallback
ETB edit Abbrechen Speichern EINTRAG ETB entry field
Funktionen handover Abbrechen Übertragen NAME NAME in the dock
CO: add a Haus Abbrechen Hinzufügen BEZEICHNUNG —
CO: remove a Haus Abbrechen — (the focused button) ABBRECHEN HAUS HINZUFÜGEN
CO: remove a Geschoss Abbrechen — (the focused button) ABBRECHEN —
CO: Wohnung editor Abbrechen — (Enter must not commit, see CoValueInput) first status button HAUS picker

Exception: CO Wohnungen entfernen. This panel still must not take focus (#419: NumericUpDown commits on LostFocus). Esc from the matrix now cancels it. CancelApartmentRemovalCommand only runs while a removal is pending, so a stray Esc no longer rebuilds the rows under the focused spinner.

Flyouts need nothing. Avalonia's Flyout already keeps the contract for the Kräfte Stärke korrigieren flyout and the Atemschutz Sicherheitstrupp picker: focus goes inside on open, and Esc closes the flyout and gives focus back to its button. New tests pin this.

Open, for #542: closing the CO Wohnung editor, even with ABBRECHEN, rebuilds the matrix, so the tile that opened it is gone and focus falls back to the HAUS picker. Landing on the rebuilt tile is #542's rebuild-stability problem. The ETB and Funktionen rows survive their own save, so focus goes back to the row's button there.

Worth a look: like the dialogs, initial focus in a text field selects all of it. In the ETB edit panel, typing straight away therefore replaces the entry text. Esc undoes that, but if editing should start with the caret at the end instead, that is a one-line change.

Screenshots

ETB: Enter on a row's edit button. Before, focus stays on the pencil in the grid, so the next key lands there. After, it is in EINTRAG.

Before
After

CO-Messung: Enter on HAUS HINZUFÜGEN.

After, CO

Tests

  • OverlayContractTests: six inline-panel scenarios, kept in their own list so the Pending* coverage test is unchanged. All four clauses pass on all six. With main's XAML, all of them fail (checked for ETB and Funktionen).
  • OverlayKeyboardTests:
    • an ETB entry edited by keyboard, with focus back on its row;
    • Enter on CO Haus entfernen removes nothing;
    • going back to a module with an open panel does not pull focus into it;
    • on a minimal panel: focus goes in and comes back on Esc, focus moved to the page is neither pulled back nor moved on close, and the fallback is used when the opener is gone.
  • CoApartmentRemovalPanelTests: Esc on the spinner cancels the removal; with nothing pending, Esc leaves the matrix and focus alone.
  • Flyouts: ForcesFlyoutKeyboardTests and ScbaSafetyTruppFlyoutTests cover open by Enter, focus inside, and Esc back to the button.
  • make clean ci: every assembly passes (Acceptance 442/442), with 0 warnings and no Test Run Failed.

Android: the ETB, Funktionen and CO add-house panels open with focus in a text field, which raises the soft keyboard. Those panels are about typing, so that is what you want. The two confirms and the Wohnung editor open on a button and do not raise it.

🤖 Generated with Claude Code

The second half of #538. The dialogs got b:Overlay in #555; the panels a
module draws in its own XAML did not, because they are shown by
IsVisible and never leave the visual tree, which is what the behaviour
listened to. None of them took focus, closed on Esc or gave focus back.

b:Overlay.IsInline makes the behaviour open and close with the panel's
own IsVisible instead, and drops the modal pull-back: the page beside a
panel stays live, so a click elsewhere is allowed, and closing then
leaves focus where the Lagebuchführer put it. Arriving at a module by
the rail does not count as opening its panel. b:Overlay.FallbackFocus
names where focus goes when the opener has gone in a rebuild.

Applied to the ETB edit panel, the Funktionen handover, and the
CO-Messung add-house, remove-house, remove-floor and Wohnung-editor
panels. The two removals are destructive confirms: focus starts on
ABBRECHEN and there is no primary command. The Wohnung editor has no
primary command either, since Enter there must not commit (see
CoValueInput). Its ABBRECHEN rebuilds the matrix, so focus falls back
to the house picker; landing on the rebuilt tile is #542's.

The Wohnungen-entfernen panel stays out, as #419 requires: it must not
take focus. Esc on the matrix now cancels it, and the cancel command is
gated on a pending removal so a stray Esc no longer rebuilds the rows
under the focused spinner.

The Forces strength and Scba Sicherheitstrupp flyouts already keep the
contract through Avalonia's Flyout; new tests pin that.

OverlayContractTests checks the four clauses on six inline-panel
scenarios as well; with main's XAML all of them fail.

Fixes #538.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975
DeepDiver1975 merged commit 734e17d into main Oct 3, 2026
8 of 9 checks passed
@DeepDiver1975
DeepDiver1975 deleted the feat/538-inline-panel-keyboard branch October 3, 2026 22:32
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.

feat(overlay): dialogs and inline panels take focus, keep Tab inside, close on Esc, return focus

1 participant