fix(ask-dewee): hide floating selection button after outside click
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- frontend
Direzione di ricerca
Start in src/ask/selection-button.ts, in mountAskButton(), where the mousedown hide, the mouseup handler that calls later() and setTimeout(show, 0), and dispose() are. Reproduce the outside-click case in Chrome first, since the issue says the root cause is unconfirmed. Extend tests/unit/ask/selection-button.test.ts with the outside-click and race sequences from the checklist. Done when the tooltip stays hidden after an outside click, reappears only on a new selection gesture, and the regression checklist passes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug report
Người dùng chọn một đoạn text trên trang → tooltip/button "Ask Dewee" xuất hiện đúng. Khi click chuột ra ngoài để bỏ selection, tooltip đôi lúc không biến mất (hoặc biến mất rồi hiện lại), che nội dung trang. Cần đảm bảo biến mất khi selection bị huỷ hoặc người dùng dismiss bằng outside click.
Code audit (main @ 1296da790de7)
src/ask/selection-button.tstrongmountAskButton():- capture listener
mousedown → onDown() → hide()đã có. - listener
mouseup → later() → setTimeout(show, 0)kiểm traselectedText()và có thể hiển thị lại khi Chrome vẫn giữ selection range sau outside click, hoặc khi timeout cũ chạy muộn. selectionchangechưa được lắng nghe;later()timers không có cancel/generation token,dispose()cũng không huỷ pending timeout.
- capture listener
tests/unit/ask/selection-button.test.tschỉ test Escape +removeAllRanges()rồimouseup; thiếu outside-click sequence + race regression. Đây là nghi vấn nguyên nhân từ code, cần xác nhận trên Chrome thực tế, chưa kết luận duy nhất root cause.
Expected behavior
- Khi người dùng tạo selection hợp lệ bằng chuột/bàn phím, Ask Dewee xuất hiện cạnh vùng chọn.
- Khi click hoặc tap/pointerdown ngoài tooltip để dismiss/bỏ text selection, tooltip biến mất và không tự hiện lại trong chính gesture đó, kể cả selection DOM tạm vẫn còn non-collapsed.
- Khi selection bị clear/collapse (selectionchange), Escape, scroll, tab navigation, hoặc unmount, tooltip biến mất.
- Chỉ xuất hiện lại khi có selection gesture mới; hỗ trợ drag-to-select tiếp theo, không làm mất trải nghiệm chọn văn bản; click chính tooltip phải giữ selected text và gửi draft một lần như hiện tại.
- Không tạo
ask.selectionmessage từ click ngoài, không capture input/textarea/contenteditable, không tự gửi text hay làm thay đổi site selection ngoài nhu cầu UX.
Suggested fix (implementation choice to verify)
- Track pointer/selection gesture state (e.g. outside pointerdown dismisses and suppresses its matching pointerup/mouseup) + fresh-selection version/generation; chỉ
show()sau selection mới thực sự phù hợp. Xử lý keyboard selection riêng. - Subscribe
selectionchangeto hide on collapsed/empty; guard debounce and suppression against browser order of events (pointerdown → mousedown → selectionchange → mouseup). - Make pending timers cancellable/generation-aware, cancel at hide/dispose/navigation. Avoid race that reopens tooltip after outside click; tests cover legacy mouse and pointer/touch.
- Keep Shadow DOM event path checks + trusted click guard.
Regression tests
- Select text → tooltip visible; outside mousedown/mouseup with selection still non-collapsed → remains hidden.
- Select → outside click clears ranges → hidden.
- New drag-selection after dismissal → visible again.
- Select via Shift+arrows/keyboard → visible; Escape hides.
- Press Ask Dewee → sends exactly one selected-text draft; no double show.
- Rapid repeat clicks, scroll, selection changes, dispose with pending timer → never re-show.
- Sensitive editable form elements excluded.
Related
- New page-awareness feature: https://github.com/nextlevelbuilder/dewee-chrome-ext/issues/30 . This is intentionally a separate, independently shippable bugfix.
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 1
- Merge medio
- 2g 5h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nextlevelbuilder/dewee-chrome-ext
-
feat(browser/ux): visible in-tab AI control indicator, action highlight and optional agent cursorApertaai-handle enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/100
-
feat(browser): structured observations v2 and policy-checked micro-batching for adaptive decisionsApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
feat(quality): QGP browser postconditions, DOM-first verification và opt-in visual escalationApertaenhancement security
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
-
enhancement security
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
nextlevelbuilder/dewee-chrome-ext#35 · 2 commenti ·
-
security(browser): block off-grant navigations in agent tabs before the request leaves ChromeForse di nuovo libera @mrgoonie l’ha presa 48 giorni fa e non c’è nessuna pull request aperta. Apertaneeds-design security
nextlevelbuilder/dewee-chrome-ext#33 · 1 assegnatario ·
Tutte le issue di nextlevelbuilder/dewee-chrome-ext
Issue simili
-
prio:low scope:hud
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OliverRomhagen/vrigstad-joyride#953 ·
I maintainer di solito rispondono entro 1 giorno
-
review-followup
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
griffinwork40/agent-afk#5446 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
kacper-szewczyk/Ticknest#346 ·
I maintainer di solito rispondono entro 1 giorno
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshApertabug plugin/echarts/geo
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
Yeachan-Heo/gajae-code#8230 ·
I maintainer di solito rispondono entro 1 giorno