Repository navigation
fix(overlay): give every dialog one keyboard contract - #555
Merged
Merged
Conversation
A new attached behaviour, b:Overlay, carries contract 1 of #545 on each overlay's root: focus goes inside once it is shown (posted, so it is not dropped before layout), Tab cycles inside, Esc runs the cancel command, Enter runs the primary command except in multi-line text, and focus goes back to the control that opened it. Focus that leaves the overlay while it is open, as when a busy form disables the focused button, comes back. All six Pending* overlays use it and lose their code-behind key handlers. TaskDialog no longer leaves focus in the ETB field behind it. ConfirmDialog sets no primary command, so Enter activates the focused button, which starts out as ABBRECHEN: a reflex Enter cancels. OverlayContractTests has no known failures left. OverlayKeyboardTests covers the TaskDialog flow from the ETB, PdfExport while busy, Enter on a remove confirm, and the behaviour's own rules. Part of #538; the inline panels and flyouts follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Visual already implements ILogical, so the pattern match in IsWithin was always true (CodeQL cs/useless-type-test). IsLogicalAncestorOf takes the Visual directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
added a commit
that referenced
this pull request
Oct 3, 2026
…raps (#556) The build does not warn about a pattern match against a type the value already has, so it only surfaces as a code-scanning alert on the pull request, as it did on #555 (Visual is always an ILogical). Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
DeepDiver1975
added a commit
that referenced
this pull request
Oct 3, 2026
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. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.
Part of #538 (PR A of two; the inline panels and flyouts follow in PR B). Part of the v0.8 keyboard epic #545.
What changes
A new attached behaviour,
b:Overlay(src/LageBuch.App.Shared/Behaviors/Overlay.cs), set on each overlay's root scrim. It implements contract 1 of #545:CancelCommandPrimaryCommandInitialFocusWhat it does beyond that:
Focus(). It's posted at a lower priority than a view's own posted focus, so OperatorPrompt's stage-aware focus stays as it was.TabNavigation="Cycle"on the root, so Tab stays inside.The six overlays and what they use:
Their code-behind key handlers are removed.
One behaviour change to confirm: ConfirmDialog no longer confirms on Enter from its checkbox. Enter activates the focused button, which starts as ABBRECHEN, so a reflex Enter after a remove cancels. Confirming now always means Tab to the destructive button, as contract 1 decided.
Screenshots
TaskDialog opened from HINZUFÜGEN & AUFGABE, and the Einsatz-abschließen confirm. Before, focus stays on the button behind the overlay, so the next key lands there. After, it is inside the dialog.
Tests
OverlayContractTests:KnownFailuresis empty. All 32 clauses pass on all 8 overlay scenarios.OverlayKeyboardTests:make clean ci: all assemblies pass (Acceptance 408/408), noTest Run Failed.Android: TaskDialog and IncidentDataDialog open with focus in a text field, which raises the soft keyboard. IncidentDataDialog already did that. The button-first overlays (Confirm, About, PdfExport) don't.
🤖 Generated with Claude Code