Repository navigation
fix(overlay): give the inline panels the same keyboard contract - #557
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 byIsVisibleand 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):IsInlineIsVisible. 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.FallbackFocusTab cycles inside an open panel, as contract 1 says. Esc, Enter and initial focus work exactly as they do for dialogs.
CoValueInput)Exception: CO Wohnungen entfernen. This panel still must not take focus (#419:
NumericUpDowncommits on LostFocus). Esc from the matrix now cancels it.CancelApartmentRemovalCommandonly runs while a removal is pending, so a stray Esc no longer rebuilds the rows under the focused spinner.Flyouts need nothing. Avalonia's
Flyoutalready 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.
CO-Messung: Enter on HAUS HINZUFÜGEN.
Tests
OverlayContractTests: six inline-panel scenarios, kept in their own list so thePending*coverage test is unchanged. All four clauses pass on all six. Withmain's XAML, all of them fail (checked for ETB and Funktionen).OverlayKeyboardTests:CoApartmentRemovalPanelTests: Esc on the spinner cancels the removal; with nothing pending, Esc leaves the matrix and focus alone.ForcesFlyoutKeyboardTestsandScbaSafetyTruppFlyoutTestscover open by Enter, focus inside, and Esc back to the button.make clean ci: every assembly passes (Acceptance 442/442), with 0 warnings and noTest 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