I realized that tabindex=-1
doesn't work for <svg></svg>
elements. Is there a way to disable the focus
event for it? preventDefault
, stopPropagation
, stopImmediatePropagation
also do not work.
Just use $(". dasvg")[0]. setAttribute("class", "disabled") assuming that the element doesn't have any classses already.
In SVG only the element <a xlink:href="…"> is considered naturally focusable by all browsers.
In order to make an prevent an element from taking focus ("non-focusable"), you need to use Javascript to watch for the focus and prevent the default interaction. In order to prevent an element from being tabbed to, use tabindex=-1 attribute. Adding tabindex=-1 will make any element focusable, even div elements.
SVG elements are actually of type HTMLElement .
<svg focusable="false"></svg>
does this job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With