A form field with the ID of mainSearch gets focus when the page loads. I am struggling to debug this and find out where that gets set in the source code. Is there a way I can debug this element to see how it is getting focus?
There are several ways to make element autofocused.
autofocus attribute.element.focus().So, if I were you, I'll search for .focus() in sources.
Then, make several break points nearby.
Maybe it is because of :focus-visible pseudo-class applies while an element matches the :focus . i also suffered many time with this,then I try
*:focus-visible{
outline:none!important;
/* your style */
}
try this
console.log(getEventListeners(document.getElementById("mainSearch")));