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 various native focus APIs #13234

Merged
merged 4 commits into from
May 20, 2024

Conversation

acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented May 14, 2024

Description

Adding native APIs to support implementation of FURN's FocusTrapZone. And generally expand native focus capabilities.

New APIs

New static FocusManager runtimeclass::

static ComponentView FocusManager.FindFirstFocusableElement(ComponentView searchScope);
static ComponentView FocusManager.FindLastFocusableElement(ComponentView searchScope);

New events on ComponentView:

event Windows.Foundation.EventHandler<LosingFocusEventArgs> LosingFocus;
event Windows.Foundation.EventHandler<GettingFocusEventArgs> GettingFocus;
event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.RoutedEventArgs> LostFocus;
event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.RoutedEventArgs> GotFocus;

New method on ComponentView:

bool TryFocus();
Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms requested review from a team as code owners May 14, 2024 19:06
@jonthysell jonthysell added the Area: Fabric Support Facebook Fabric label May 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric label May 14, 2024
@jonthysell
Copy link
Contributor

So this is just adding native events so custom ComponentViews can better respond to focus changes?

@acoates-ms
Copy link
Contributor Author

So this is just adding native events so custom ComponentViews can better respond to focus changes?

Correct.

@jonthysell jonthysell self-assigned this May 16, 2024
@acoates-ms acoates-ms merged commit 0d5ad19 into microsoft:main May 20, 2024
53 checks passed
@acoates-ms acoates-ms deleted the nativefocusapis branch May 20, 2024 18:01
acoates-ms added a commit to acoates-ms/react-native-windows that referenced this pull request May 20, 2024
* [Fabric] Add various native focus APIs

* format

* Change files

* fix
acoates-ms added a commit that referenced this pull request May 20, 2024
* [Fabric] Add various native focus APIs (#13234)

* [Fabric] Add various native focus APIs

* format

* Change files

* fix

* fix change files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Fabric Support Facebook Fabric New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants