From 4d36a5ff208e457932ee6baa67b20e59c70e9f90 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 27 Aug 2026 10:36:43 +0800 Subject: [PATCH] fix(kline): blur focused control after arrow-key switching to drop stray focus ring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 点过分时tab/外链等控件后方向键切股, 浏览器会给该已聚焦控件显示 focus-visible 默认蓝色 outline(应用未自定义 focus 样式, 即浏览器默认环)。 切股成功后 blur 掉当前聚焦元素, 一次覆盖弹窗内所有控件。 Co-Authored-By: Claude --- frontend/src/components/StockPreviewDialog.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/StockPreviewDialog.tsx b/frontend/src/components/StockPreviewDialog.tsx index 9adf3e4..8c22aab 100644 --- a/frontend/src/components/StockPreviewDialog.tsx +++ b/frontend/src/components/StockPreviewDialog.tsx @@ -224,7 +224,12 @@ export function StockPreviewDialog({ symbol, name, onClose, triggerInfo, navList const t = e.target as HTMLElement | null if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.tagName === 'SELECT' || t.isContentEditable)) return if (showMonitorEditor) return - if (go(e.key === 'ArrowRight' ? 1 : -1)) e.preventDefault() + if (go(e.key === 'ArrowRight' ? 1 : -1)) { + e.preventDefault() + // 切股后清掉控件残留的键盘焦点: 点过分时tab/外链等控件后方向键切股, + // 浏览器会给该控件显示 focus-visible 默认蓝色 outline, 切换后 blur 掉避免残留 + ;(document.activeElement as HTMLElement | null)?.blur() + } } } document.addEventListener('keydown', handler)