If you use :focus-visible
and add an outline there, then it will only show when a user interacts with your button with the keyboard, and not with a mouse.
If you use outline rather than border than you won't get layout shifts either, as outline isn't calculated in the element size so the size won't change when it's added and removed
Marked as helpful