microsoft / microsoft/react-native-windows
Focus rect doesn't pick up on rounded corners
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
Problem Description
If I tab into a custom Pressable component, the focus rect always has crisp pointed edges, even if my control is rounded.
For places where we wrap a WinUI control, it works correctly:
Never mind the lack of label, the rounding is picked up:
This is a react-native-xaml HyperlinkButton, which is why it works:
Steps To Reproduce
Add a borderRadius to the root of your component.
const MyTerribleButton = ({title, onPress}: MyTerribleButtonProps) => (
<Pressable onPress={() => onPress()}
style={{borderRadius: 20}}>
<View style={{backgroundColor: 'blue' borderRadius: 20}}>
<Text
style={{color: 'white'}}>
{title}
</Text>
</View>
</Pressable>
);
Doesn't matter where you put that borderRadius, it won't be picked up for the focus rect.
Expected Results
Let's contrast with controls from the WinUI 2 Gallery:
The capability is really illustrated by tabbing here:
CLI version
11.3.6
Environment
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.23551
CPU: "(24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores "
Memory: 38.03 GB / 63.86 GB
Binaries:
Node:
version: 18.17.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.19
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 9.4.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.18362.0
- 10.0.19041.0
- 10.0.22000.0
- 10.0.22621.0
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.7.34024.191 (Visual Studio Community 2022)
- 16.11.33927.289 (Visual Studio Community 2019)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
react-native-windows:
installed: 0.72.9
wanted: 0.72.9
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Target Platform Version
None
Target Device(s)
Desktop
Visual Studio Version
Visual Studio 2022
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the custom Pressable on the Windows desktop target and trace its focus-rect behavior against the WinUI-wrapped control; done when a root borderRadius is reflected in the keyboard focus rectangle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, react-native
- Domain
- accessibility, desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100