From 3a579070b80ed38802f45f4aaa9b390654d12366 Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 12 Aug 2026 16:11:05 +0200 Subject: [PATCH 1/2] feat: enhance accessibility for Input and InputLabel components --- src/components/form/Input.tsx | 17 ++++++++++++++++- src/components/form/InputLabel.tsx | 6 ++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/form/Input.tsx b/src/components/form/Input.tsx index 2782ab718..12a1328f9 100644 --- a/src/components/form/Input.tsx +++ b/src/components/form/Input.tsx @@ -137,6 +137,18 @@ const InputComponent = React.forwardRef>( onInput: userOnInput, ...inputProps } = rest + + const generatedId = React.useId() + const inputId = (inputProps.id as string | undefined) ?? generatedId + const labelId = `${inputId}-label` + const ariaLabelFallback = !title + ? ((inputProps["aria-label"] as string | undefined) ?? (inputProps.placeholder as string | undefined)) + : undefined + const accessibilityProps = { + id: inputId, + ...(title ? {"aria-labelledby": labelId} : {}), + ...(ariaLabelFallback ? {"aria-label": ariaLabelFallback} : {}), + } const wrapperRef = useRef(null) const inputRef = useRef(null) @@ -728,6 +740,7 @@ const InputComponent = React.forwardRef>( key={syntaxRenderKey} ref={editorRef as any} {...mergedEditableProps} + {...accessibilityProps} contentEditable={!disabled && !disabledOnValue} suppressContentEditableWarning aria-disabled={disabled || disabledOnValue} @@ -762,6 +775,7 @@ const InputComponent = React.forwardRef>(