Feedback
Expose focus-visible state for custom controls
- Status
- Fixed
- Fixed in
- v26.8.5
- Source discussion
- https://forum.objo.dev/d/874-custom-canvas-button-and-focusing
- Last updated
- 2026-08-22
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
Expose a read-only FocusVisible property on the desktop Control base class so custom controls (for example a Canvas used as a button) can draw their own focus indicator only when focus arrived through keyboard navigation.
Native controls show their focus indicator only when focus arrived via keyboard navigation. Objo currently exposes FocusReceived and FocusLost but not the focus-visible distinction. User-maintained mouse/focus flags fail when a modal dialog temporarily takes focus and later restores it.
Proposed semantics for Control.FocusVisible:
Trueonly while the control has focus that should show a visible focus indicator.- Keyboard navigation (Tab or directional) makes it
True. - Pointer-acquired focus makes it
False. - Unspecified focus (including normal programmatic focus and modal focus restoration) makes it
False. - Losing focus makes it
False. - Independent of
Canvas.AllowFocusRing; disabling the standard ring must not preventFocusVisiblefrom becomingTrueso an application can draw a custom equivalent.
Typical use:
Sub Canvas1_Paint(g As Graphics)
# Draw the control...
If Canvas1.FocusVisible Then
# Draw the custom focus indicator...
End If
End Sub