Skip to content

Conversation

@c3n9
Copy link
Contributor

@c3n9 c3n9 commented Sep 5, 2025

Problem
The ToggleSwitch control in Material.Avalonia lacks proper visual feedback when focused via keyboard navigation (Tab, Shift+Tab), gamepad, or other input methods. This creates accessibility issues and poor user experience for:

  • Users who rely on keyboard navigation exclusively
  • Accessibility requirements (WCAG 2.1 success criterion 2.4.7)
  • Gamepad and TV interface scenarios
  • Power users preferring keyboard shortcuts

Technical Changes

  • Added focus state handling in ToggleSwitch template
  • Extended ripple effect system to support focus state
  • Disabled default focus adorner in favor of Material Design visuals
  • Added smooth transitions for focus state changes

@c3n9
Copy link
Contributor Author

c3n9 commented Sep 5, 2025

If it's a good idea, I or someone else can continue adding effects to all the elements. To completely remove the ugly dot focus limiter. It doesn't fit into the overall visual picture in any way.

@c3n9
Copy link
Contributor Author

c3n9 commented Sep 5, 2025

before
image
after
image

@SKProCH SKProCH self-requested a review September 5, 2025 09:51
@SKProCH SKProCH added the enhancement New feature or request label Sep 5, 2025
Copy link
Collaborator

@SKProCH SKProCH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall fine

@c3n9
Copy link
Contributor Author

c3n9 commented Sep 6, 2025

The FocusAdorner property is used to show a default focus visual, typically a Border, around a Control with :focus-visible. When using :focus-visible to show a custom visual indicator, setting FocusAdorner to null will avoid showing a duplicate indicator.

@c3n9
Copy link
Contributor Author

c3n9 commented Sep 6, 2025

I changed focus to focus-visible.

@c3n9
Copy link
Contributor Author

c3n9 commented Sep 6, 2025

Now the visual effect will only work when navigating with the keyboard. This will allow us to improve all other controls in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants