omnibox: apply same fade+blur logic when navigating suggestion results (arrow/hover); always restore on input typing/focus
- commit
- 66e5fc88dc5d1de3b081afb61e05f490faf47d62
- author
- bamen · · 2025-09-09 19:44 UTC
- committer
- bamen · · 2025-09-09 19:22 UTC
- parent
- 32dec1e
- signature
- unsigned
1 file · +7 -4
M pkg/webkit/ucm_js_cgo.go +7 -4
| @@ -139,13 +139,16 @@ func getOmniboxScript() string { | |||
| 139 | 139 | if (H.selectedIndex<0) H.selectedIndex = n-1; if (H.selectedIndex>=n) H.selectedIndex = 0; | |
| 140 | 140 | H.paintList(); | |
| 141 | 141 | H.scrollListToSelection(); | |
| 142 | - | if (H.mode==='find') { H.revealSelection(); H.setFaded(true); } | |
| 142 | + | // Fade overlay while navigating results; also reveal active match in find mode | |
| 143 | + | H.setFaded(true); | |
| 144 | + | if (H.mode==='find') { H.revealSelection(); } | |
| 143 | 145 | } | |
| 144 | 146 | } else { | |
| 145 | - | if (H.mode==='find') H.setFaded(false); | |
| 147 | + | // Any other key input should restore full opacity while editing | |
| 148 | + | H.setFaded(false); | |
| 146 | 149 | } | |
| 147 | 150 | }); | |
| 148 | - | input.addEventListener('input', ()=> { H.onInput(); if (H.mode==='find') H.setFaded(false); }); | |
| 151 | + | input.addEventListener('input', ()=> { H.onInput(); H.setFaded(false); }); | |
| 149 | 152 | input.addEventListener('mousedown', ()=> H.setFaded(false)); | |
| 150 | 153 | input.addEventListener('click', ()=> H.setFaded(false)); | |
| 151 | 154 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | |
| @@ -184,7 +187,7 @@ func getOmniboxScript() string { | |||
| 184 | 187 | const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;'; | |
| 185 | 188 | text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl); | |
| 186 | 189 | item.appendChild(icon); item.appendChild(text); | |
| 187 | - | item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); }); | |
| 190 | + | item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); H.setFaded(true); }); | |
| 188 | 191 | item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); }); | |
| 189 | 192 | list.appendChild(item); | |
| 190 | 193 | }); | |
| @@ -139,13 +139,16 @@ func getOmniboxScript() string { | |||||
| 139 | if (H.selectedIndex<0) H.selectedIndex = n-1; if (H.selectedIndex>=n) H.selectedIndex = 0; | 139 | if (H.selectedIndex<0) H.selectedIndex = n-1; if (H.selectedIndex>=n) H.selectedIndex = 0; | ||
| 140 | H.paintList(); | 140 | H.paintList(); | ||
| 141 | H.scrollListToSelection(); | 141 | H.scrollListToSelection(); | ||
| 142 | - | if (H.mode==='find') { H.revealSelection(); H.setFaded(true); } | 142 | + | // Fade overlay while navigating results; also reveal active match in find mode |
| 143 | + | H.setFaded(true); | |||
| 144 | + | if (H.mode==='find') { H.revealSelection(); } | |||
| 143 | } | 145 | } | ||
| 144 | } else { | 146 | } else { | ||
| 145 | - | if (H.mode==='find') H.setFaded(false); | 147 | + | // Any other key input should restore full opacity while editing |
| 148 | + | H.setFaded(false); | |||
| 146 | } | 149 | } | ||
| 147 | }); | 150 | }); | ||
| 148 | - | input.addEventListener('input', ()=> { H.onInput(); if (H.mode==='find') H.setFaded(false); }); | 151 | + | input.addEventListener('input', ()=> { H.onInput(); H.setFaded(false); }); |
| 149 | input.addEventListener('mousedown', ()=> H.setFaded(false)); | 152 | input.addEventListener('mousedown', ()=> H.setFaded(false)); | ||
| 150 | input.addEventListener('click', ()=> H.setFaded(false)); | 153 | input.addEventListener('click', ()=> H.setFaded(false)); | ||
| 151 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | 154 | H.el = root; H.input = input; H.list = list; H.selectedIndex = -1; H.paintList(); | ||
| @@ -184,7 +187,7 @@ func getOmniboxScript() string { | |||||
| 184 | const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;'; | 187 | const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;'; | ||
| 185 | text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl); | 188 | text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl); | ||
| 186 | item.appendChild(icon); item.appendChild(text); | 189 | item.appendChild(icon); item.appendChild(text); | ||
| 187 | - | item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); }); | 190 | + | item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); H.setFaded(true); }); |
| 188 | item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); }); | 191 | item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); }); | ||
| 189 | list.appendChild(item); | 192 | list.appendChild(item); | ||
| 190 | }); | 193 | }); | ||