adobe / adobe/react-spectrum

Unable to pass ref to Datepicker [react-aria-components]

Open
#7,756 10 comments 7 reactions 0 assignees View on GitHub
DatePicker good first issue
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

I have a custom [Datepicker](https://react-spectrum.adobe.com/react-aria/DatePicker.html) component that I'm integrating with `react-hook-form`. I was wondering which component should received the ref (passed by forwardRef), I need to do so since `react hook form` uses this ref to focus an element on error (think a form submission that has client validation)

I've tried with the `DatePicker` and `DateInput` but no luck.

### 🤔 Expected Behavior?

Ref should be received by the `DatePicker` or `DateInput` component.

### 😯 Current Behavior

Looks like the ref is not being received by the mentioned react-aria-components.

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

You can use the documentation https://react-spectrum.adobe.com/react-aria/DatePicker.html

### Version

1.5.0

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

macos sequoia

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_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.