From fad40dda97c4c4ecc4165524d0898494582ccac2 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 12 Feb 2024 20:49:50 -0600 Subject: [PATCH] Improve a11y of inputs (#2846) * Improve a11y of inputs * Remove old comment --- src/components/forms/TextField.tsx | 50 +++++++++--------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 99d5e715..ebf2e475 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -5,13 +5,11 @@ import { TextInputProps, TextStyle, ViewStyle, - Pressable, StyleSheet, AccessibilityProps, } from 'react-native' import {HITSLOP_20} from 'lib/constants' -import {isWeb} from '#/platform/detection' import {useTheme, atoms as a, web, tokens, android} from '#/alf' import {Text} from '#/components/Typography' import {useInteractionState} from '#/components/hooks/useInteractionState' @@ -41,7 +39,6 @@ export type RootProps = React.PropsWithChildren<{isInvalid?: boolean}> export function Root({children, isInvalid = false}: RootProps) { const inputRef = React.useRef(null) - const rootRef = React.useRef(null) const { state: hovered, onIn: onHoverIn, @@ -72,35 +69,17 @@ export function Root({children, isInvalid = false}: RootProps) { ], ) - React.useLayoutEffect(() => { - const root = rootRef.current - if (!root || !isWeb) return - // @ts-ignore web only - root.tabIndex = -1 - }, []) - return ( - inputRef.current?.focus()} - onHoverIn={onHoverIn} - onHoverOut={onHoverOut}> + inputRef.current?.focus(), + onMouseOver: onHoverIn, + onMouseOut: onHoverOut, + })}> {children} - + ) } @@ -187,7 +166,6 @@ export function createInput(Component: typeof TextInput) { @@ -313,7 +294,6 @@ export function Suffix({ const ctx = React.useContext(Context) return (