When a link is clicked in google chrome, the focus event does not fire. All other browsers fire a focal event for links.
<a href=# onfocus="console.log('focus')">Link</a>
I do not want to attach the onmousedown event, but onfocus.
Does anyone have a workaround idea.
EDIT:
I definitely consider this a mistake, because all other focusing elements cause focus on the click.
Even non-concentrated elements with a tabindex trigger focus on click in google chrome.
<div tabindex="-1" onfocus="console.log('focus')">div</div>
I cannot connect to both click and focus , because then onclick other browsers will call this function twice. I cannot detect this functionality because it requires user interaction, and I will not perform detection with a user agent string because it is good.
Using this html:
<a href=# onfocus="console.log('focus')" onmousedown="console.log('mousedown')">Link</a>
Is this in any way invalidating the second onmousedown call onmousedown that the function is called twice in browsers without a browser.
EDIT 2:
After some additional testing, <input type=radio> also fails to trigger focus in google chrome. Why in the world it is google chrome like this, while Opera, IE and firefox are all right. What is crazy is that the mobile web browser browser even launches link links when I tried it on my Android device.
source share