fix(ui): apply WebKitGTK date picker workaround to remaining 7 inputs (#188)
All checks were successful
PR Check / rust (pull_request) Successful in 22m55s
PR Check / frontend (pull_request) Successful in 2m29s

Extends PR #189's fix (one input on /balance/snapshot) to the 7 remaining
native <input type="date"> fields across 4 components:
- transactions/TransactionFilterBar.tsx (dateFrom + dateTo)
- adjustments/AdjustmentForm.tsx (form.date)
- balance/LinkTransfersModal.tsx (from + to)
- dashboard/PeriodSelector.tsx (localFrom + localTo)

Each onChange handler now calls e.currentTarget.blur() after the state
update to dismiss the native date popup on Linux Tauri WebView. The call
is a no-op on Windows WebView2 / macOS WKWebView, where the picker
already auto-closes.

No automated test added: this is a WebKitGTK-specific WebView quirk that
cannot be reproduced in jsdom/vitest. Manual smoke test on Linux Tauri
dev was the validation, mirroring PR #189's approach.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-05-03 16:19:20 -04:00
parent fbd8be403a
commit 3b9badb726
6 changed files with 37 additions and 11 deletions

View file

@ -18,6 +18,7 @@
- Bilan : la sauvegarde d'un snapshot utilise désormais une transaction atomique BEGIN/COMMIT et valide toutes les lignes avant toute écriture en BDD, empêchant les snapshots orphelins lorsque la validation échoue. La migration v11 nettoie les orphelins existants (#176).
- Bilan : le sélecteur de date sur `/balance/snapshot` se ferme maintenant après la sélection sur Linux (WebKitGTK) au lieu de rester ouvert jusqu'à ce que l'utilisateur appuie sur Échap. Le contournement appelle `blur()` sur le champ après chaque changement — sans effet sur Windows WebView2 / macOS WKWebView, où le sélecteur se ferme déjà automatiquement (#177).
- Mise à jour de la dépendance `postcss` (8.5.6 → 8.5.13) pour corriger l'avis de sécurité de sévérité modérée GHSA-qx2v-qp2m-jg93 (XSS via `</style>` non échappé dans le stringifier CSS). Transitive via vite, build-time uniquement — aucun impact runtime sur le binaire Tauri livré (#180).
- Contournement du sélecteur de date WebKitGTK étendu aux 7 autres champs `<input type="date">` natifs répartis sur 4 composants (barre de filtres Transactions, formulaire Ajustements, modal de Liaison de transferts, sélecteur de période). Chaque handler onChange appelle désormais `e.currentTarget.blur()` pour fermer le popup natif sur Linux Tauri WebView — sans effet sur Windows WebView2 / macOS WKWebView. Même approche que #177 (#188).
## [0.9.0] - 2026-04-29

View file

@ -18,6 +18,7 @@
- Bilan: snapshot save now uses atomic BEGIN/COMMIT and validates all lines before any DB write, preventing orphan snapshot rows when validation fails. Migration v11 cleans existing orphans (#176).
- Bilan: snapshot date picker on `/balance/snapshot` now closes after a date is selected on Linux (WebKitGTK), instead of staying open until the user pressed Esc. Workaround calls `blur()` on the input after each change — no-op on Windows WebView2 / macOS WKWebView, where the picker already auto-closes (#177).
- Updated `postcss` dependency (8.5.6 → 8.5.13) to address moderate severity advisory GHSA-qx2v-qp2m-jg93 (XSS via unescaped `</style>` in CSS stringifier). Transitive via vite, build-time only — no runtime impact on the shipped Tauri binary (#180).
- WebKitGTK date picker workaround extended to the remaining 7 native `<input type="date">` fields across 4 components (Transactions filter bar, Adjustments form, Link Transfers modal, Period selector). Each onChange handler now calls `e.currentTarget.blur()` to dismiss the native popup on Linux Tauri WebView — no-op on Windows WebView2 / macOS WKWebView. Same approach as #177 (#188).
## [0.9.0] - 2026-04-29

View file

@ -71,7 +71,11 @@ export default function AdjustmentForm({
<input
type="date"
value={form.date}
onChange={(e) => setForm({ ...form, date: e.target.value })}
onChange={(e) => {
setForm({ ...form, date: e.target.value });
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
className="w-full px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--card)] text-sm focus:outline-none focus:ring-1 focus:ring-[var(--primary)]"
/>
</div>

View file

@ -229,7 +229,11 @@ export default function LinkTransfersModal({
<input
type="date"
value={from}
onChange={(e) => setFrom(e.target.value)}
onChange={(e) => {
setFrom(e.target.value);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
className="w-full px-2 py-1.5 bg-[var(--background)] border border-[var(--border)] rounded text-sm"
/>
</label>
@ -240,7 +244,11 @@ export default function LinkTransfersModal({
<input
type="date"
value={to}
onChange={(e) => setTo(e.target.value)}
onChange={(e) => {
setTo(e.target.value);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
className="w-full px-2 py-1.5 bg-[var(--background)] border border-[var(--border)] rounded text-sm"
/>
</label>

View file

@ -94,7 +94,11 @@ export default function PeriodSelector({
<input
type="date"
value={localFrom}
onChange={(e) => setLocalFrom(e.target.value)}
onChange={(e) => {
setLocalFrom(e.target.value);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
className="px-3 py-1.5 rounded-lg text-sm border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)]"
/>
</div>
@ -105,7 +109,11 @@ export default function PeriodSelector({
<input
type="date"
value={localTo}
onChange={(e) => setLocalTo(e.target.value)}
onChange={(e) => {
setLocalTo(e.target.value);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
className="px-3 py-1.5 rounded-lg text-sm border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)]"
/>
</div>

View file

@ -167,9 +167,11 @@ export default function TransactionFilterBar({
<input
type="date"
value={filters.dateFrom ?? ""}
onChange={(e) =>
onFilterChange("dateFrom", e.target.value || null)
}
onChange={(e) => {
onFilterChange("dateFrom", e.target.value || null);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
placeholder={t("transactions.filters.dateFrom")}
className="px-3 py-2 text-sm rounded-lg border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:ring-1 focus:ring-[var(--primary)]"
/>
@ -177,9 +179,11 @@ export default function TransactionFilterBar({
<input
type="date"
value={filters.dateTo ?? ""}
onChange={(e) =>
onFilterChange("dateTo", e.target.value || null)
}
onChange={(e) => {
onFilterChange("dateTo", e.target.value || null);
// Close native date popup on WebKitGTK (#177)
e.currentTarget.blur();
}}
placeholder={t("transactions.filters.dateTo")}
className="px-3 py-2 text-sm rounded-lg border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:ring-1 focus:ring-[var(--primary)]"
/>