|
12 | 12 |
|
13 | 13 | import {AriaTextFieldProps} from '@react-types/textfield'; |
14 | 14 | import {DOMAttributes, ValidationResult} from '@react-types/shared'; |
15 | | -import {filterDOMProps, getOwnerWindow, mergeProps, useFormReset} from '@react-aria/utils'; |
| 15 | +import {filterDOMProps, mergeProps, useFormReset} from '@react-aria/utils'; |
16 | 16 | import React, { |
17 | 17 | ChangeEvent, |
18 | 18 | HTMLAttributes, |
19 | 19 | type JSX, |
20 | 20 | LabelHTMLAttributes, |
21 | 21 | RefObject, |
22 | | - useEffect, |
23 | 22 | useState |
24 | 23 | } from 'react'; |
25 | 24 | import {useControlledState} from '@react-stately/utils'; |
@@ -147,24 +146,6 @@ export function useTextField<T extends TextFieldIntrinsicElements = DefaultEleme |
147 | 146 | useFormReset(ref, props.defaultValue ?? initialValue, setValue); |
148 | 147 | useFormValidation(props, validationState, ref); |
149 | 148 |
|
150 | | - useEffect(() => { |
151 | | - // This works around a React/Chrome bug that prevents textarea elements from validating when controlled. |
152 | | - // We prevent React from updating defaultValue (i.e. children) of textarea when `value` changes, |
153 | | - // which causes Chrome to skip validation. Only updating `value` is ok in our case since our |
154 | | - // textareas are always controlled. React is planning on removing this synchronization in a |
155 | | - // future major version. |
156 | | - // https://github.com/facebook/react/issues/19474 |
157 | | - // https://github.com/facebook/react/issues/11896 |
158 | | - if (ref.current instanceof getOwnerWindow(ref.current).HTMLTextAreaElement) { |
159 | | - let input = ref.current; |
160 | | - Object.defineProperty(input, 'defaultValue', { |
161 | | - get: () => input.value, |
162 | | - set: () => {}, |
163 | | - configurable: true |
164 | | - }); |
165 | | - } |
166 | | - }, [ref]); |
167 | | - |
168 | 149 | return { |
169 | 150 | labelProps, |
170 | 151 | inputProps: mergeProps( |
|
0 commit comments