Skip to content

fix: TextInputFocus state not in sync with View focus #2553

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

Merged
merged 3 commits into from
Jul 23, 2025

Conversation

Saadnajmi
Copy link
Collaborator

Summary:

This is fixed upstream with facebook#52472 . Let's commit (and backport) a smaller fix for now.

Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on "Pressable Child 2" twice by clicking on the container

      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>

@Saadnajmi Saadnajmi merged commit 8819d6c into microsoft:main Jul 23, 2025
5 of 19 checks passed
@Saadnajmi Saadnajmi deleted the textinputfocus branch July 23, 2025 00:35
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jul 23, 2025
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jul 23, 2025
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jul 23, 2025
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jul 23, 2025
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jul 23, 2025
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant