Skip to content

fix(toolbar): show the focus ring only for keyboard use - #1689

Open
adnan-bhaldar wants to merge 2 commits into
KnifeLemon:mainfrom
adnan-bhaldar:fix/toolbar-focus-ring-on-click
Open

adnan-bhaldar wants to merge 2 commits into
KnifeLemon:mainfrom
adnan-bhaldar:fix/toolbar-focus-ring-on-click

Conversation

@adnan-bhaldar

Copy link
Copy Markdown
Collaborator

Tip

Start the title with a prefix so the PR is labeled automatically: feat: fix: docs: ci: build: i18n:
Example: fix(hwp): keep tables when converting to DOCX

What does this change?

  • Remembers whether the last input on the Toolbar page was a key press or a click.
  • KeepFocus gives focus with NavigationMethod.Pointer after a click, and with NavigationMethod.Tab after a key press.

Why was it changed?

  • Clicking Edit Donut Size or Done moves the keyboard focus to the button that takes its place, so keyboard users don't lose their place.
  • That focus was given with NavigationMethod.Tab, so Avalonia drew the focus ring on the button after a mouse click too.
  • The ring should show where the keyboard is, so it should only appear when the keyboard is being used.
  • The last input is read from the key and pointer events themselves. Reading it from the last focus change would miss a click on a control that already has focus.

Type of change

  • Bug fix
  • New feature or improvement
  • New format or engine
  • Translation
  • Documentation
  • Build, CI or dependencies

How was it tested?

  • dotnet format --verify-no-changes
  • dotnet test
  • Tried it in the app (what you converted or clicked, and on which OS): Windows 11

Checklist

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files (no new strings)
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none added)
  • The PR does one thing (unrelated changes go in a separate PR)

After clicking Edit Donut Size or Done on the Toolbar page, the page hands
the keyboard focus to the button that takes its place (KeepFocus). It did so
with NavigationMethod.Tab, so the focus ring was drawn even though the user
had used the mouse.

Remember whether the last input was a key press or a click, and give the
focus with NavigationMethod.Pointer after a click, so no ring is drawn. After
a key press it is still given with Tab, so keyboard users see the ring.
@github-actions github-actions Bot added the bug Something isn't working label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant