In the script remove the highlight?

There is a script seamless scrole to the link. But when he clicks on the anchor, then this anchor is highlighted with a blue border. What to change in script to avoid this selection? Or are there any similar scripts seamless all based on the same principles that this Java script?

LINK TO THE SCRIPT

5a2b7184ea25c745751052.png5a2b718924cea877627499.png
// Select all links with hashes
$('a[href*="#"]')
 // Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
 .click(function(event) {
 // On-page links
 if (
 location.pathname.replace(/^\//, ") == this.pathname.replace(/^\//, ") 
 && 
 location.hostname == this.hostname
 ) {
 // Figure out the element to scroll to
 var target = $(this.hash);
 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
 // Does a scroll target exist?
 if (target.length) {
 // Only prevent default if the animation is actually gonna happen
event.preventDefault();
 $('html, body').animate({
 scrollTop: target.offset().top
 }, 1000, function() {
 // Callback after animation
 // Must change focus!
 var $target = $(target);
$target.focus();
 if ($target.is(":focus")) { // Checking if the target was focused
 return false;
 } else {
 $target.attr('tabindex','-1'); // Adding the tabindex for elements not focusable
 $target.focus(); // Set focus again
};
});
}
}
 });
June 10th 19 at 16:52
3 answers
June 10th 19 at 16:54
Solution
to remove
$target.focus();
the condition for tabindex then slomaetsa - Finn_Emmerich commented on June 10th 19 at 16:57
this condition is a crutch to set focus. Will not install, will not have the condition. - aniya commented on June 10th 19 at 17:00
Well, if something else sets the focus, you can register directly:
$target.blur(); - rhianna_Fee commented on June 10th 19 at 17:03
don't see the requirements tab index
if the author was worried about accessibility, the question about removing the focus would not be standing - Pedro65 commented on June 10th 19 at 17:06
June 10th 19 at 16:56
Solution
a:focus {
 outline: none;
}
this only will get rid of the blue frame, and the focus will remain, thus requiring a double-click on the next element, obvious bug - Finn_Emmerich commented on June 10th 19 at 16:59
guessing that was the question of the author. - aniya commented on June 10th 19 at 17:02
June 10th 19 at 16:58
Solution
XS, I'm usually in the initial reset just these are the letters they write:
*{outline:none;}
And I have ceased to bother nightmares.

Find more questions by tags JavaScript