When using a mouse to click an anchor which triggers a script that sets focus to another element, the focused element matches :focus-visible. On a single page application this is really noticeable and arguably not desired behaviour. See https://codepen.io/HazzMan2409/pen/rNdYNpa Note this is very similar to this bug https://bugs.webkit.org/show_bug.cgi?id=236782 Maybe this issue occurs with other elements (not just anchors).
<rdar://problem/98113373>
Not just clicking with a mouse, but tapping on iOS too.