Repository navigation
fix(ui): keep a clicked row ringless after leaving and coming back to the window - #871
Conversation
… the window Minimising or leaving the window took focus from the clicked row, which dropped its pointer-focus mark; on return it took focus again, and with a key as the last input it came back unmarked and ringed. The mark is now dropped only once focus has moved elsewhere in the page, and focus that returns from outside the page keeps the mark it had. Refs #866
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Follow-up to #868, for #866. It was found by testing that fix on Windows.
The bug
Steps to reproduce:
The row came back with its focus ring (and, in playlists, its inset ring too: a double green line).
Why:
focusout, which dropped itsdata-pointer-focusmark.focusinagain. The last input was a key, so it was treated as keyboard focus and left unmarked.Fix (
src/lib/inputModality.ts)focusoutdrops the mark only once focus has actually moved elsewhere in the page. It checksdocument.activeElementon the next tick: when the whole window loses focus, the element stays the active one.focusinonly clears a mark when focus moved here from another element (relatedTarget !== null). Focus that returns from outside the page keeps the mark it had. Pointer focus still marks, and keyboard navigation between elements still clears it.Both cases were tested on Windows (WebView2): a letter or digit after a click or a double-click, then minimise and restore. No ring appears in either.
The same commit goes into the 1.9.2 backport (#870).
@coderabbitai review
Summary by CodeRabbit