The headless browser for AI agents and web scraping
fix(cdp): implement triple-click select-all for text inputs (#316 follow-up) (#320)
zhangyang-crazy-one5d01b5eb6a97
diff --git a/crates/obscura-cdp/src/domains/input.rs b/crates/obscura-cdp/src/domains/input.rsindex 1e0010a4..519e2a58 100644--- a/crates/obscura-cdp/src/domains/input.rs+++ b/crates/obscura-cdp/src/domains/input.rs@@ -47,6 +47,16 @@ pub async fn handle(}} else if (tag === 'INPUT' && (type === 'checkbox' || type === 'radio')) {{\target.checked = !target.checked;\try {{ target.dispatchEvent(globalThis.__obscura_markTrusted(new Event('change', {{bubbles:true}}))); }} catch(e) {{}}\+ }} else if ({click_count} >= 3 && (tag === 'INPUT' || tag === 'TEXTAREA')) {{\+ // Triple-click selects all text (browser native behavior not replicated+ // by synthetic MouseEvent, so we do it manually).+ var len = target.value ? target.value.length : 0;\+ if (target.setSelectionRange) {{\+ target.setSelectionRange(0, len);\+ }} else {{\+ target.selectionStart = 0;\+ target.selectionEnd = len;\+ }}\}}\}}\}}\