GeekyAnts / GeekyAnts/NativeBase

AlertDialog leastDestructiveRef is useless

Open
#5,236 1 comment 0 reactions 0 assignees View on GitHub
bug triage v3
Dominant language
TypeScript
Stars
20.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### Description

AlertDialog should put focus on the leastDestructiveRef when the alert is opened.

### CodeSandbox/Snack link

https://snack.expo.dev/@jasontank/leastdestructiveref

### Steps to reproduce

1. Go to https://docs.nativebase.io/alert-dialog
2. The sole example has "Cancel" set as leastDestructiveRef, but even that one defaults to the [X] close button instead of the referenced button.
3. Opening the modal and then hitting Enter uses the [X] instead of the [Cancel] button.
4. The expected behavior happens when you use initialFocusRef instead of leastDestructiveRef, so either this is a bug or leastDestructiveRef has been deprecated and the docs need to be updated.

### NativeBase Version

3.4.6

### Platform

- [ ] Android
- [ ] CRA
- [X] Expo
- [ ] iOS
- [ ] Next

### Other Platform

web

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.