Skip to content
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

feat(DevTools): Focus follower #12813

Conversation

workgroupengineering
Copy link
Contributor

@workgroupengineering workgroupengineering commented Sep 7, 2023

What does the pull request do?

Added Focus Highlighter item to DevTools Overlays menu, which allows you to highlight the currently focused item with the specified color.

feature

What is the current behavior?

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #12241

@workgroupengineering workgroupengineering changed the title feat(DevTools): Fccus follower feat(DevTools): Focus follower Sep 7, 2023
@workgroupengineering workgroupengineering force-pushed the features/DevTools/Focus-follower branch from 0850159 to 2787233 Compare September 7, 2023 15:52
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039273-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039624-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

if (FocusHighlighter is IBrush brush
&& element is InputElement input
&& TopLevel.GetTopLevel(input) is { } topLevel
&& topLevel.GetType().FullName != "Avalonia.Diagnostics.Views.MainWindow")
Copy link
Member

Choose a reason for hiding this comment

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

In this project, you can simply check with "is Avalonia.Diagnostics.Views.MainWindow". Why do you need reflection?

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039646-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member

maxkatz6 commented Sep 20, 2023

While this PR looks good to me, we can try to reuse normal FocusAdorner.
I.e. each control has already integrated focus adorner functionality, it's just not always visible on focus.

As a possible implementation, I am thinking about adding this toggle property to AdornerLayer class. Which can be read on this condition

(e.NavigationMethod == NavigationMethod.Tab ||
e.NavigationMethod == NavigationMethod.Directional))

The same DevTools toggle can also override AdornerLayer.DefaultFocusAdorner property to make it more visible as well.

What do you think?
My bad that I thought about it only now.

@workgroupengineering
Copy link
Contributor Author

While this PR looks good to me, we can try to reuse normal FocusAdorner. I.e. each control has already integrated focus adorner functionality, it's just not always visible on focus.

As a possible implementation, I am thinking about adding this toggle property to AdornerLayer class. Which can be read on this condition

(e.NavigationMethod == NavigationMethod.Tab ||
e.NavigationMethod == NavigationMethod.Directional))

The same DevTools toggle can also override AdornerLayer.DefaultFocusAdorner property to make it more visible as well.

What do you think? My bad that I thought about it only now.

I'll try.

@workgroupengineering workgroupengineering marked this pull request as draft September 22, 2023 09:34
@workgroupengineering
Copy link
Contributor Author

@maxkatz6 I tried to apply your suggestion in commit 3d60326, I don't like how solution increases complexity and there are some problems with popup windows. Do I continue on the path you suggested?

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039794-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@workgroupengineering workgroupengineering marked this pull request as ready for review November 6, 2023 10:04
@maxkatz6 maxkatz6 added this pull request to the merge queue Nov 7, 2023
Merged via the queue into AvaloniaUI:master with commit cbf86c4 Nov 7, 2023
5 checks passed
@workgroupengineering workgroupengineering deleted the features/DevTools/Focus-follower branch November 7, 2023 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DevTools] Focus follower
3 participants