For a11y(accessibility) I added this css which I can't change .Below css is always present in my demo application. I don't have any control to change that css.
button:focus,
a:focus {
outline-offset: 2px;
outline-width: 2px !important;
outline-style: dotted !important;
outline-color: currentColor;
}
but issue is when I click on button it show me outline
. how to remove that outline on button click .
to resolve this issue I saw two option .
- use
blur
event on click .It hide theoutline
. but for few second it show the outline .this does not work for me - use this
pseudo
https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible .but it does not work on safari
is there any better way or any custom. hook which remove focus on button click ?
Here is my code
https://codesandbox.io/s/angry-lamarr-lz586?file=/src/styles.css:59-207
function handleProductNavigation(event) {
btnRef.current.blur();
console.log(btnRef.current.blur);
//event.currentTarget.blur();
}