fix: make VisuallyHidden's element type as span when it's inside phrasing element (#3013)

* fix(checkbox): make VisuallyHidden's element type as span

* feat(changeset): add changeset

* fix(radio): make the VisuallyHidden element type as span

* fix(switch): make the VisuallyHidden element type as span

* fix(select): make the VisuallyHidden element type as span

* feat(changeset): replace changeset

* chore: fix formatting
This commit is contained in:
Artem Pitikin 2024-05-20 16:03:29 +03:00 committed by GitHub
parent 0108d06d3b
commit 06ecd213cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1,8 @@
---
"@nextui-org/checkbox": patch
"@nextui-org/radio": patch
"@nextui-org/select": patch
"@nextui-org/switch": patch
---
make the VisuallyHidden `elementType` as span when the default parent element accepts only phrasing elements

View File

@ -26,7 +26,7 @@ const Checkbox = forwardRef<"input", CheckboxProps>((props, ref) => {
return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>{clonedIcon}</span>

View File

@ -22,7 +22,7 @@ const Radio = forwardRef<"input", RadioProps>((props, ref) => {
return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>

View File

@ -130,7 +130,9 @@ function Select<T extends object>(props: Props<T>, ref: ForwardedRef<HTMLSelectE
<div {...getInnerWrapperProps()}>
{startContent}
<span {...getValueProps()}>{renderSelectedItem}</span>
{endContent && state.selectedItems && <VisuallyHidden>,</VisuallyHidden>}
{endContent && state.selectedItems && (
<VisuallyHidden elementType="span">,</VisuallyHidden>
)}
{endContent}
</div>
{renderIndicator}

View File

@ -35,7 +35,7 @@ const Switch = forwardRef<"input", SwitchProps>((props, ref) => {
return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>