<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<circle id="myCircle" cx="100" cy="100" r="50" tabindex="0" fill="blue" />
<button id="focusButton">Focus the circle</button>
</svg>SVGElement: focus() method / notebook
SVGElement: focus() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
document.getElementById("focusButton").addEventListener("click", () => {
const circle = document.getElementById("myCircle");
circle.focus();
});