JSFiddle - React, Tailwind, and code Playground
HTML
<a id="testlink" href="#">Click this</a>
CSS
#testlink:active {
color: red;
}
JavaScript
var lnk = document.getElementById('testlink');
var mousedown = false;
var timerId = null;
lnk.addEventListener('mousedown', function(e) {
mousedown = true;
timerId = window.setTimeout(function() {
if (mousedown) {
lnk.blur();
}
}, 500);
});
lnk.addEventListener('click', function(e) {
mousedown = false;
window.clearTimeout(timerId);
});