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

fix: Button should not fire the click event on the space key when it is not active #16619

Conversation

workgroupengineering
Copy link
Contributor

What does the pull request do?

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 #16184

@avaloniaui-bot
Copy link

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

@workgroupengineering
Copy link
Contributor Author

Hi @amwx , when you have time try this PR.

@avaloniaui-bot
Copy link

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

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

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

I'm a bit torn here. Child controls are supposed to mark events as handled to avoid special cases in parent controls. Here, doing so with KeyDown/KeyUp will prevent TextInput, so that's not a viable solution.

Since this PR solves a real problem, let's go with the focus check for now. I don't see any immediate issue with it, but that's the kind of change that might break unusual hierarchies. Let's be vigilant for future issues.

src/Avalonia.Controls/Button.cs Outdated Show resolved Hide resolved
src/Avalonia.Controls/Button.cs Outdated Show resolved Hide resolved
src/Avalonia.Controls/Button.cs Outdated Show resolved Hide resolved
src/Avalonia.Controls/Button.cs Outdated Show resolved Hide resolved
@MrJul MrJul added the bug label Aug 11, 2024
@avaloniaui-bot
Copy link

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

@MrJul MrJul added this pull request to the merge queue Aug 16, 2024
Merged via the queue into AvaloniaUI:master with commit 44528a8 Aug 16, 2024
10 checks passed
@workgroupengineering workgroupengineering deleted the fixes/Controls/Button/Issue_#16184 branch August 16, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button should check RoutedEventArgs.Source before handling keys
3 participants