Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
May 20, 2024
8 changes: 8 additions & 0 deletions .changeset/thick-frogs-jog.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/components/checkbox/src/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Checkbox = forwardRef<"input", CheckboxProps>((props, ref) => {

return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>{clonedIcon}</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/radio/src/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Radio = forwardRef<"input", RadioProps>((props, ref) => {

return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/select/src/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<div {...getInnerWrapperProps()}>
{startContent}
<span {...getValueProps()}>{renderSelectedItem}</span>
{endContent && state.selectedItems && <VisuallyHidden>,</VisuallyHidden>}
{endContent && state.selectedItems && <VisuallyHidden elementType="span">,</VisuallyHidden>}

Check warning on line 133 in packages/components/select/src/select.tsx

View workflow job for this annotation

GitHub Actions / ESLint

Replace `<VisuallyHidden·elementType="span">,</VisuallyHidden>` with `(⏎··············<VisuallyHidden·elementType="span">,</VisuallyHidden>⏎············)`
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
{endContent}
</div>
{renderIndicator}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/switch/src/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Switch = forwardRef<"input", SwitchProps>((props, ref) => {

return (
<Component {...getBaseProps()}>
<VisuallyHidden>
<VisuallyHidden elementType="span">
<input {...getInputProps()} />
</VisuallyHidden>
<span {...getWrapperProps()}>
Expand Down
Loading