[Fabric][Composition] Expose a non-mutating focusability API on ComponentView (e.g. IsFocusable ) for FocusZone / single-tab-stop scenarios
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 45/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- cpp, react-native
- Domínio
- desktop-dev, frontend
Direção de pesquisa
Comece rastreando ComponentView.TryFocus e o ponto de entrada solicitado e não mutável para verificar a possibilidade de receber foco na implementação de Composition. Em seguida, inspecione Composition.FocusManager.FindFirstFocusableElement, FindLastFocusableElement e GettingFocusEventArgs.TrySetNewFocusedComponent, incluindo o caminho de ativação de IFocusManagerStatics. Considera-se concluído quando a consulta primária estiver disponível sem mover o foco e o comportamento da API secundária para aplicativos RNW hospedados estiver esclarecido ou corrigido.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Problem Description
Building a FocusZone / single-tab-stop control on Composition (New Architecture) requires identifying the next focusable ComponentView in tab order. Today there is no non-mutating way to test whether a ComponentView can take focus, so we must call ComponentView.TryFocus(...) in a loop — which moves focus as a side effect while probing. We need a query API that reports focusability without changing focus.
What we're doing
Native RCTFocusZone implementation. On Tab we want to move focus to the first focusable element outside the zone in one transition; arrow keys navigate within. To find that element we DFS the tree and call TryFocus on each candidate until one succeeds, because there's no way to ask "is this focusable?" first.
Gaps
- No non-mutating focusability property on ComponentView . Requesting an IsFocusable / Focusable (get-only bool ) property, so we can select the correct target without side-effecting focus.
- Composition.FocusManager.FindFirstFocusableElement / FindLastFocusableElement statics throw — their activation factory ( IFocusManagerStatics ) isn't registered in the runtime we load, so get_activation_factory throws (fatal inside a noexcept input handler). If these are the intended API, they need to be usable from a hosted RNW app.
- GettingFocusEventArgs.TrySetNewFocusedComponent(ComponentView) projects as void (no success bool ), so we can't redirect focus during GettingFocus and know whether it was accepted, forcing focus logic into KeyDown instead.
Ask
Primarily (1) a non-mutating focusability query on ComponentView . Secondarily, clarify/fix (2) and (3) so focus navigation can be built without trial-and-error TryFocus .
Workaround
DFS + TryFocus trial-and-error in KeyDown , which mutates focus while probing and costs a tree walk per keystroke.
Steps To Reproduce
- In a react-native-windows Fabric (Composition / New Architecture) app, add a native
component (e.g. a custom FocusZone) that subclasses the codegen ComponentView and, in
Initialize, registers a KeyDown handler on the container ComponentView. - In that handler, try to move keyboard focus to the next focusable ComponentView in tab
order (e.g. on Tab, the first focusable element outside the zone). To do this you must
determine which ComponentView can accept focus. - Look for a non-mutating way to test whether a given ComponentView is focusable. There is
none: ComponentView.TryFocus(FocusState) is the only option, and it moves focus as a
side effect while probing. - Result: you have to call TryFocus in a loop across candidate views, causing focus to
actually move during probing, and there is no API to identify the correct target up front.
Expected Results
No response
CLI version
CLI version is 13.6.9
Environment
react-native-windows 0.81.5 (Fabric / Composition), Microsoft.ReactNative C++/WinRT
Community Modules
No response
Target React Native Architecture
None
Target Platform Version
None
Visual Studio Version
None
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
- Linguagem predominante
- C++
- Estrelas
- 17.4k
- Forks
- 1.2k
- Merge médio
- 2d 23h
- PRs com merge (30d)
- 16
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoft/react-native-windows
-
Fabric text is drawn with ClearType onto transparent composition surfaces, fringing thin glyphsAbertaNeeds: Triage :mag:
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
microsoft/react-native-windows#16340 ·
Mantenedores costumam responder em até 2 dias
-
bug Needs: Triage :mag:
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
microsoft/react-native-windows#16321 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
bug Needs: Triage :mag:
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
microsoft/react-native-windows#16479 ·
Mantenedores costumam responder em até 2 dias
-
Needs: Triage :mag:
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
microsoft/react-native-windows#16442 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
Fabric: activating the window doesn't announce the window or the focused control to a screen readerAbertaNeeds: Triage :mag:
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
microsoft/react-native-windows#16435 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de microsoft/react-native-windows
Issues semelhantes
-
Web3 RPC: one-element batch request returns an object instead of an array (breaks ethers.js v6)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
FISCO-BCOS/FISCO-BCOS#5706 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
521xueweihan/HelloGitHub#4011 ·
-
docs(simulation): Quickstart publishes UDP 14550, which the SITL images' own docs say not to doAbertastatus:needs-triage
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
PX4/PX4-Autopilot#29292 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
I/O internal correctness medium priority rt_lib
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
Mantenedores costumam responder em até 1 dia
-
GUI
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
sonic-pi-net/sonic-pi#3594 ·