feat: Add focusableRef support to DateInput#9185
feat: Add focusableRef support to DateInput#9185hasegawa-101 wants to merge 15 commits intoadobe:mainfrom
focusableRef support to DateInput#9185Conversation
0e2e8b6 to
9cddf2d
Compare
# Conflicts: # packages/react-aria-components/src/DateField.tsx
# Conflicts: # packages/react-aria-components/src/DateField.tsx
snowystinger
left a comment
There was a problem hiding this comment.
Thanks for fixing that. We had a little discussion on Friday about this plus the ask for the inputRef, so we're revisiting a little because that's a lot of refs. I doubt we'll reach a decision on how to reduce the overall number before the new year, just to give you a heads up.
I'm approving for now
|
An alternative to exposing a third ref on DateInput (in addition to |
|
Thanks everyone for taking a look at this. At the moment, integrating At the moment we do: <Controller
name="date"
render={({ field, fieldState }) => (
<>
<DatePicker>
<DateInput
name={field.name}
onChange={field.onChange}
onBlur={field.onBlur}
isDisabled={field.disabled}
value={field.value}
isInvalid={fieldState.error !== undefined}
validationBehavior="aria"
ref={(ref) => {
if (ref) {
field.ref(
Object.defineProperty(ref, "focus", {
value(this: HTMLDivElement) {
this.querySelector<HTMLSpanElement>(
'[role="spinbutton"]',
)?.focus();
},
writable: true,
configurable: true,
}),
);
}
}}
/>
<FieldError>{fieldState.error?.message}</FieldError>
</DatePicker>
</>
)}
rules={{ required: "This field is required" }}
/>UPD: It seems that when using validationBehavior="aria" with other components CheckboxGroup, RadioGroup as well as DatePicker, one will need to implement focus management themselves. |
Closes #7756
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: