-
Notifications
You must be signed in to change notification settings - Fork 243
Create focus.md #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create focus.md #392
Conversation
docs/concepts/input/focus.md
Outdated
|
||
Focus navigation by tab occurs when the user presses tab on their keyboard. `InputElement`s with their `IsTabStop` property | ||
set to `true` will be available for tab focus navigation. The `TabIndex` specifies the priority with lower numeric values being | ||
navigated to first. When `TabIndex` is equal, the order of appearance within the Visual Tree is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, something like "When TabIndex
is equal, the order in which control is definition used". It's not entirely true, but should be good enough simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit too simple because that only makes sense in the context of a single XAML document, not necessarily across documents or anything created by code.
docs/concepts/input/focus.md
Outdated
|:---------------|--------------------------------------------------------------------------------| | ||
| :focus | The Control has focus. | | ||
| :focus-within | The Control has focus or contains a descendant that has focus. | | ||
| :focus-visible | The Control has focus and received it from Tab or Directional focus navigation | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more specific, focus-visible
tells that control should use focus styles. Like, text box changes its appearance when focused. Additionally, if control overrides :focus-visible
, it might need to set FocusAdorner to null:
https://github.com/AvaloniaUI/Avalonia/blob/0cd220f6c2ae409f5a27c261d09c2eb5836ad2fe/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml#L107
As otherwise double focus visuals would be applied.
docs/concepts/input/focus.md
Outdated
## Directional Focus Navigation <MinVersion version="11.1" /> | ||
|
||
Focus navigation through `XYFocus` is a 2D directional scheme enabling spatial navigation from the focused control | ||
towards another control to a cardinal direction: left, right, up, or down. `XYFocus.NavigationModes` is `Disabled` by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, it's Gamepad | Remote. Which means, it is enabled only for these types of controllers.
docs/concepts/input/focus.md
Outdated
`KeyDeviceType.Gamepad` is not yet supported, so `XYFocus` navigation is currently limited to `Keyboard` (arrow keys) | ||
and `Remote` (tvOS most commonly). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gamepad is technically supported, as Android and Tizen already can send this kind of input. We don't have a proper Gamepad APIs, but that's a different story, not related to XY focus or KeyDeviceType.
docs/concepts/input/focus.md
Outdated
<Style Selector=":is(Control).directional-navigation"> | ||
<Setter Property="XYFocus.NavigationModes" Value="Enabled" /> | ||
<Setter Property="XYFocus.UpNavigationStrategy" Value="Projection" /> | ||
<Setter Property="XYFocus.DownNavigationStrategy" Value="Projection" /> | ||
<Setter Property="XYFocus.LeftNavigationStrategy" Value="Projection" /> | ||
<Setter Property="XYFocus.RightNavigationStrategy" Value="Projection" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These properties are inheritable, so it might make more sense to set it on top level.
Thanks for the review. Fixed the errors, added suggestions, and cleaned up some new nits after another proofread pass. |
Creates general documentation for all focus-related features I'm aware of, including XYFocus.
I wasn't able to think of a compelling example of tab navigation and most other features are "basic", so I only added an example for XYFocus. If more are added, Focus may need to be split into several documents.
Tab focus navigation may be a bit suspect/underdeveloped as I don't understand the area well. Particularly this statement is hand-wavy:
Part of: #384