Skip to content

FocusManager fails with buttons in safari and firefox #138

@TrySound

Description

@TrySound

We need to find some solution to work around it both safari and firefox

Ref https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus

Example

<html>

<body>
<button tabindex="-1">Click me</button>

<script>

const button = document.querySelector("button")

// focus event is fixed with custom firing
button.addEventListener("mousedown", event => {
  if (event.currentTarget.tagName === 'BUTTON') {
    event.currentTarget.focus();
  }
});

button.addEventListener("focus", () => {
  console.log("focus");
});

// sadly blur is fired straight after focus
button.addEventListener("blur", () => {
  console.log('blur');
})

</script>
</body>

</html>

/cc @souporserious

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions