Skip to content

fix: Allow Key property in XAML for KeyboardAccelerator - #22362

Merged
MartinZikmund merged 1 commit into
masterfrom
dev/mazi/keyboard-accelerators-sourcegen
Jan 19, 2026
Merged

MartinZikmund merged 1 commit into
masterfrom
dev/mazi/keyboard-accelerators-sourcegen

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Jan 14, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #22094

PR Type: 🐞 Bugfix

What is the current behavior? 🤔

The XAML source generator was incorrectly filtering out all properties named "Key", which was intended to exclude x:Key directive but also excluded legitimate properties like KeyboardAccelerator.Key.

Changed the filter to only exclude Key when it has the XAML namespace (x:Key), allowing regular Key properties to be generated.

What is the new behavior? 🚀

PR Checklist ✅

Please check if your PR fulfills the following requirements:

Other information ℹ️

Copilot AI review requested due to automatic review settings January 14, 2026 17:08
@github-actions github-actions Bot added the area/code-generation Categorizes an issue or PR as relevant to code generation label Jan 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the XAML source generator where all properties named "Key" were being filtered out, which incorrectly excluded legitimate properties like KeyboardAccelerator.Key in addition to the x:Key XAML directive.

Changes:

  • Modified the property filtering logic to only exclude x:Key (XAML directive) by checking both the property name and namespace
  • Added a comprehensive source generator test to verify KeyboardAccelerator.Key property can be set in XAML

Reviewed changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs Updated GetExtendedProperties method to check namespace when filtering "Key" properties, allowing regular Key properties while still excluding x:Key directives
src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Parser.cs Added test case When_KeyboardAccelerator_Key_Property to verify the fix works correctly
src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/Given_Parser/WhKeAcKePr/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs Expected generated code output showing Key property is correctly initialized
src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/Given_Parser/WhKeAcKePr/XamlCodeGenerator_LocalizationResources.cs Generated localization resources metadata file
src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/Given_Parser/WhKeAcKePr/XamlCodeGenerator_GlobalStaticResources.cs Generated global static resources file

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund MartinZikmund self-assigned this Jan 16, 2026
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/keyboard-accelerators-sourcegen branch from 358d8b4 to 389c6ef Compare January 16, 2026 16:25
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 191594 has failed on Uno.UI - CI.

@MartinZikmund

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 191628 has failed on Uno.UI - CI.

The XAML source generator was incorrectly filtering out all properties
named "Key", which was intended to exclude x:Key directive but also
excluded legitimate properties like KeyboardAccelerator.Key.

Changed the filter to only exclude Key when it has the XAML namespace
(x:Key), allowing regular Key properties to be generated.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/keyboard-accelerators-sourcegen branch from 389c6ef to 8f7d262 Compare January 18, 2026 08:08
Copilot AI review requested due to automatic review settings January 18, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 5 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 191681 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund merged commit 4c5a1ea into master Jan 19, 2026
58 of 59 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/keyboard-accelerators-sourcegen branch January 19, 2026 09:43
@MartinZikmund

Copy link
Copy Markdown
Member Author

@Mergifyio backport release/stable/6.5

@mergify

mergify Bot commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.5

✅ Backports have been created

Details

kazo0 added a commit that referenced this pull request Jan 22, 2026
…6.5/pr-22362

fix: Allow `Key` property in XAML for `KeyboardAccelerator` (backport #22362)
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Desktop] Keyboard accelerators do not work

4 participants