Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): keep password reveal toggle out of the tab order (#17020)

Max Deichmann747bbe5430aa
diff --git a/web/src/components/design-system/PasswordInput/PasswordInput.stories.tsx b/web/src/components/design-system/PasswordInput/PasswordInput.stories.tsx
index 18bb9ce87c..2329e6724d 100644
--- a/web/src/components/design-system/PasswordInput/PasswordInput.stories.tsx
+++ b/web/src/components/design-system/PasswordInput/PasswordInput.stories.tsx
@@ -43,6 +43,23 @@ export const TestTogglesVisibility = meta.story({
},
});
+export const TestSkipsVisibilityToggleWhenTabbing = meta.story({
+ name: "(Test) Skips Visibility Toggle When Tabbing",
+ args: {
+ "aria-label": "Password",
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByLabelText("Password");
+ const toggle = canvas.getByRole("button", { name: "Show password" });
+
+ input.focus();
+ await userEvent.tab();
+
+ await expect(toggle).not.toHaveFocus();
+ },
+});
+
export const TestDisablesVisibilityToggle = meta.story({
name: "(Test) Disables Visibility Toggle",
args: {
diff --git a/web/src/components/design-system/PasswordInput/PasswordInput.tsx b/web/src/components/design-system/PasswordInput/PasswordInput.tsx
index b428dc9749..abc6214da6 100644
--- a/web/src/components/design-system/PasswordInput/PasswordInput.tsx
+++ b/web/src/components/design-system/PasswordInput/PasswordInput.tsx
@@ -42,6 +42,9 @@ export function PasswordInput({ ref, disabled, ...props }: PasswordInputProps) {
aria-label={isPasswordVisible ? "Hide password" : "Show password"}
aria-pressed={isPasswordVisible}
disabled={disabled}
+ // Keep the reveal toggle out of the tab order so Tab moves between the
+ // form's inputs. It stays reachable for pointer and screen reader users.
+ tabIndex={-1}
className="absolute top-1/2 right-3 -translate-y-1/2 transform cursor-pointer disabled:cursor-not-allowed"
onClick={() => setIsPasswordVisible((visible) => !visible)}
>