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

[Fabric] Add onSubmitEditing and clearTextOnSubmit #12746

Merged
merged 5 commits into from
Feb 21, 2024

Conversation

TatianaKapos
Copy link
Contributor

@TatianaKapos TatianaKapos commented Feb 16, 2024

Description

Adds onSumbitEditing and clearTextOnSubmit to TextInput

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

TextInput parity

What

Adds onSumbitEditing event to TextInput and keeps track of if the shift key is pressed.

Screenshots

Playground-composition_QPMHOlSOIT.mp4

Testing

tested locally

Changelog

no

Microsoft Reviewers: Open in CodeFlow

@TatianaKapos TatianaKapos requested a review from a team as a code owner February 16, 2024 18:42
@@ -786,6 +791,11 @@ void WindowsTextInputComponentView::OnKeyUp(
lParam |= 0x40000000; // bit 30
lParam |= 0x80000000; // bit 31 always 1 for WM_KEYUP

// check to see if shift is released
if (args.Key() == winrt::Windows::System::VirtualKey::Shift) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this works but is there a better way to know if the shift key is pressed down? Didn't want to add the rest of the keys until I got confirmation on this :)

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't try to keep track of the key state in WindowsTextInputComponentView. Instead you should query the state as needed.

The KeyboardSource object has a method to get the key state of a key, you should pass that to the ShouldSubmit function.

@TatianaKapos TatianaKapos changed the title [Fabric] Add onSubmitEditing with shift and clearTextOnSubmit [Fabric] Add onSubmitEditing and clearTextOnSubmit Feb 16, 2024
@TatianaKapos TatianaKapos merged commit c390c66 into microsoft:main Feb 21, 2024
48 checks passed
@TatianaKapos TatianaKapos deleted the tk-onSubmit branch February 21, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants