Oh, I used the Firefox dev tools to disable that focus
event and the first click behaved as expected. Is it because that JS is first removing the search value searchBar.value = ""
so Firefox puts the caret at the beginning/end of an empty string, and then the value is immediately put back with searchBar.value = value
but now the browser does not know where in the string it was originally clicked, because it's technically a different string?