find/omnibox: fully restore opacity when typing or refocusing input; also on input click/mousedown and root hover
- commit
- 2de1562cbcc082228a12c04a6fa4ae0cdf8df23c
- author
- bamen · · 2025-09-09 18:06 UTC
- committer
- bamen · · 2025-09-09 16:51 UTC
- parent
- d5a4bab
- signature
- unsigned
1 file · +6 -2
M pkg/webkit/ucm_js_cgo.go +6 -2
| @@ -104,7 +104,7 @@ func getOmniboxScript() string { | |||
| 104 | 104 | box.addEventListener('mousedown', (e)=>{ e.stopPropagation(); }, true); | |
| 105 | 105 | // Focus and select input on hover for quick typing | |
| 106 | 106 | input.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); input.select(); } catch(_) { input.focus(); } } }); | |
| 107 | - | root.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); } catch(_) { input.focus(); } } }); | |
| 107 | + | root.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); } catch(_) { input.focus(); } H.setFaded(false); } }); | |
| 108 | 108 | // Clear fading when user goes back to input typing | |
| 109 | 109 | input.addEventListener('focus', ()=> H.setFaded(false)); | |
| 110 | 110 | input.addEventListener('keydown', (e)=>{ | |
| @@ -136,9 +136,13 @@ func getOmniboxScript() string { | |||
| 136 | 136 | H.scrollListToSelection(); | |
| 137 | 137 | if (H.mode==='find') { H.revealSelection(); H.setFaded(true); } | |
| 138 | 138 | } | |
| 139 | + | } else { | |
| 140 | + | if (H.mode==='find') H.setFaded(false); | |
| 139 | 141 | } | |
| 140 | 142 | }); | |
| 141 | - | input.addEventListener('input', ()=> H.onInput()); | |
| 143 | + | input.addEventListener('input', ()=> { H.onInput(); if (H.mode==='find') H.setFaded(false); }); | |
| 144 | + | input.addEventListener('mousedown', ()=> H.setFaded(false)); | |
| 145 | + | input.addEventListener('click', ()=> H.setFaded(false)); | |
| 142 | 146 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | |
| 143 | 147 | }, | |
| 144 | 148 | onInput(){ | |
| @@ -104,7 +104,7 @@ func getOmniboxScript() string { | |||||
| 104 | box.addEventListener('mousedown', (e)=>{ e.stopPropagation(); }, true); | 104 | box.addEventListener('mousedown', (e)=>{ e.stopPropagation(); }, true); | ||
| 105 | // Focus and select input on hover for quick typing | 105 | // Focus and select input on hover for quick typing | ||
| 106 | input.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); input.select(); } catch(_) { input.focus(); } } }); | 106 | input.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); input.select(); } catch(_) { input.focus(); } } }); | ||
| 107 | - | root.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); } catch(_) { input.focus(); } } }); | 107 | + | root.addEventListener('mouseenter', ()=>{ if (H.visible) { try { input.focus({preventScroll:true}); } catch(_) { input.focus(); } H.setFaded(false); } }); |
| 108 | // Clear fading when user goes back to input typing | 108 | // Clear fading when user goes back to input typing | ||
| 109 | input.addEventListener('focus', ()=> H.setFaded(false)); | 109 | input.addEventListener('focus', ()=> H.setFaded(false)); | ||
| 110 | input.addEventListener('keydown', (e)=>{ | 110 | input.addEventListener('keydown', (e)=>{ | ||
| @@ -136,9 +136,13 @@ func getOmniboxScript() string { | |||||
| 136 | H.scrollListToSelection(); | 136 | H.scrollListToSelection(); | ||
| 137 | if (H.mode==='find') { H.revealSelection(); H.setFaded(true); } | 137 | if (H.mode==='find') { H.revealSelection(); H.setFaded(true); } | ||
| 138 | } | 138 | } | ||
| 139 | + | } else { | |||
| 140 | + | if (H.mode==='find') H.setFaded(false); | |||
| 139 | } | 141 | } | ||
| 140 | }); | 142 | }); | ||
| 141 | - | input.addEventListener('input', ()=> H.onInput()); | 143 | + | input.addEventListener('input', ()=> { H.onInput(); if (H.mode==='find') H.setFaded(false); }); |
| 144 | + | input.addEventListener('mousedown', ()=> H.setFaded(false)); | |||
| 145 | + | input.addEventListener('click', ()=> H.setFaded(false)); | |||
| 142 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | 146 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | ||
| 143 | }, | 147 | }, | ||
| 144 | onInput(){ | 148 | onInput(){ | ||