Fixing Focus Ring on Toggle Input

Jason Wood:
When I open a card window, this toggle input has a focus ring around it.

I tried the following ChatGPT suggestions which did not work:

<input ... autofocus="false">
and
<input ... @mounted="setTimeout(() => { $el.blur(); }, 100)">

I could do <input ... tabindex="-1"> but eventually I’m going to want this app to be accessible, so users need to be able to tab to this object.

image


Delfs:
hmm I guess you could run some code to deselect in onFormLoad but that seems meh


Jason Wood:
And there’s another annoying side effect of <input ... tabindex="-1"> and that is that while the halo no longer appears on load, strangely it appears whenever you toggle with the mouse, which it doesn’t do normally. :man-shrugging:


Delfs:
yeah because it’s non-selectable


Delfs:
JS route is better or another sacrificial element perhaps


Jason Wood:
Solved in onFormLoad with document.activeElement.blur();


Delfs:
bingo