25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(ui): correct encrypted export passphrase tab order
zipg50e49d06bce5
diff --git a/apps/desktop/src/components/config/ConfigPassphraseDialog.vue b/apps/desktop/src/components/config/ConfigPassphraseDialog.vueindex 5c3bd6e4bc..7b4c1541e7 100644--- a/apps/desktop/src/components/config/ConfigPassphraseDialog.vue+++ b/apps/desktop/src/components/config/ConfigPassphraseDialog.vue@@ -76,12 +76,12 @@ const displayError = computed(() => error.value || props.externalError || "");<div class="grid gap-2"><Label>{{ t("configExport.passphrase") }}</Label>- <PasswordInput v-model="passphrase" :placeholder="t('configExport.passphrasePlaceholder')" @keydown.enter="mode === 'import' ? confirm() : undefined" />+ <PasswordInput v-model="passphrase" :placeholder="t('configExport.passphrasePlaceholder')" :toggle-tab-index="-1" @keydown.enter="mode === 'import' ? confirm() : undefined" /></div><div v-if="mode === 'export'" class="grid gap-2"><Label>{{ t("configExport.passphraseConfirm") }}</Label>- <PasswordInput v-model="passphraseConfirm" :placeholder="t('configExport.passphraseConfirmPlaceholder')" @keydown.enter="confirm" />+ <PasswordInput v-model="passphraseConfirm" :placeholder="t('configExport.passphraseConfirmPlaceholder')" :toggle-tab-index="-1" @keydown.enter="confirm" /></div><p v-if="displayError" class="text-sm text-destructive">{{ displayError }}</p>diff --git a/apps/desktop/src/components/ui/PasswordInput.vue b/apps/desktop/src/components/ui/PasswordInput.vueindex 56fd198ad9..a6603f3b6a 100644--- a/apps/desktop/src/components/ui/PasswordInput.vue+++ b/apps/desktop/src/components/ui/PasswordInput.vue@@ -13,6 +13,7 @@ const props = withDefaults(class?: string;inputClass?: string;showToggle?: boolean;+ toggleTabIndex?: number;showLabel?: string;hideLabel?: string;}>(),@@ -29,7 +30,16 @@ const toggleLabel = computed(() => (visible.value ? props.hideLabel || t("common<template><div :class="props.class" class="relative"><Input v-model="model" :type="visible ? 'text' : 'password'" :placeholder="placeholder" :disabled="disabled" :class="[props.inputClass, props.showToggle ? 'pr-8' : undefined]" v-bind="$attrs" />- <button v-if="props.showToggle" type="button" :disabled="disabled" class="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground disabled:pointer-events-none disabled:opacity-50" :aria-label="toggleLabel" :title="toggleLabel" @click="visible = !visible">+ <button+ v-if="props.showToggle"+ type="button"+ :disabled="disabled"+ :tabindex="toggleTabIndex"+ class="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground disabled:pointer-events-none disabled:opacity-50"+ :aria-label="toggleLabel"+ :title="toggleLabel"+ @click="visible = !visible"+ ><Eye v-if="!visible" class="size-3.5" /><EyeOff v-else class="size-3.5" /></button>diff --git a/apps/desktop/src/lib/__tests__/ui/passwordInput.spec.ts b/apps/desktop/src/lib/__tests__/ui/passwordInput.spec.tsnew file mode 100644index 0000000000..568c9060e6--- /dev/null+++ b/apps/desktop/src/lib/__tests__/ui/passwordInput.spec.ts@@ -0,0 +1,46 @@+// @vitest-environment happy-dom++import { createApp, nextTick, ref } from "vue";+import { createI18n } from "vue-i18n";+import { afterEach, describe, expect, it } from "vitest";+import PasswordInput from "@/components/ui/PasswordInput.vue";++const mountedApps: Array<ReturnType<typeof createApp>> = [];++async function mountPasswordInput(toggleTabIndex?: number) {+ const host = document.createElement("div");+ document.body.appendChild(host);+ const app = createApp({+ components: { PasswordInput },+ setup() {+ return { toggleTabIndex, value: ref("") };+ },+ template: '<PasswordInput v-model="value" :toggle-tab-index="toggleTabIndex" />',+ });+ app.use(+ createI18n({+ legacy: false,+ locale: "en",+ messages: { en: { common: { hidePassword: "Hide password", showPassword: "Show password" } } },+ }),+ );+ app.mount(host);+ mountedApps.push(app);+ await nextTick();+ return host.querySelector("button") as HTMLButtonElement;+}++afterEach(() => {+ for (const app of mountedApps.splice(0)) app.unmount();+ document.body.replaceChildren();+});++describe("PasswordInput", () => {+ it("keeps the visibility toggle in the default tab order", async () => {+ expect((await mountPasswordInput()).tabIndex).toBe(0);+ });++ it("allows forms to remove the visibility toggle from the tab order", async () => {+ expect((await mountPasswordInput(-1)).tabIndex).toBe(-1);+ });+});