Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/password-a11y.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/fuselage': patch
'@rocket.chat/fuselage-forms': patch
---

Fix PasswordInput a11y violations by adding ARIA attributes to the toggle icon.
14 changes: 9 additions & 5 deletions packages/fuselage/src/components/PasswordInput/PasswordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useToggle } from '@rocket.chat/fuselage-hooks';
import { forwardRef } from 'react';

import { Icon } from '../Icon';
import { IconButton } from '../Button';
import { InputBox, type InputBoxProps } from '../InputBox';

// TODO: fix a11y issues


export type PasswordInputProps = Omit<InputBoxProps, 'type'>;

Expand All @@ -19,10 +19,14 @@ const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
<InputBox
type={hidden ? 'password' : 'text'}
addon={
<Icon
name={hidden ? 'eye-off' : 'eye'}
size={20}
<IconButton
icon={hidden ? 'eye-off' : 'eye'}
mini
onClick={handleAddonClick}
role="button"
tabIndex={0}
aria-label={hidden ? "Show password" : "Hide password"}
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleAddonClick(); } }}
/>
}
ref={ref}
Expand Down
Loading