chore: add accessible name to the icon button (#3300)

This commit is contained in:
Ryo Matsukawa 2024-06-23 21:58:39 +09:00 committed by GitHub
parent 069163053f
commit edd48a09cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
"@nextui-org/chip": patch
"@nextui-org/input": patch
---
Add accessible name to the icon button (#2802, #2808)

View File

@ -69,7 +69,7 @@ export default function App() {
variant="bordered"
placeholder="Enter your password"
endContent={
<button className="focus:outline-none" type="button" onClick={toggleVisibility}>
<button className="focus:outline-none" type="button" onClick={toggleVisibility} aria-label="toggle password visibility">
{isVisible ? (
<EyeSlashFilledIcon className="text-2xl text-default-400 pointer-events-none" />
) : (

View File

@ -130,6 +130,7 @@ export function useChip(originalProps: UseChipProps) {
role: "button",
tabIndex: 0,
className: slots.closeButton({class: classNames?.closeButton}),
"aria-label": "close chip",
...mergeProps(closePressProps, closeFocusProps),
};
};

View File

@ -473,6 +473,7 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
...props,
role: "button",
tabIndex: 0,
"aria-label": "clear input",
"data-slot": "clear-button",
"data-focus-visible": dataAttr(isClearButtonFocusVisible),
className: slots.clearButton({class: clsx(classNames?.clearButton, props?.className)}),