Skip to content

Removing focused element inside dialog or dropdown makes CPU spike in chrome. #1605

Closed
@s-yadav

Description

@s-yadav

Bug report

Current Behavior

Removing focused element inside dialog or dropdown makes CPU spike. Possibly due to focus trapping logic.

Screen.Recording.2022-08-08.at.11.05.58.PM.mov

Expected behavior

CPU spike shouldn't happen

Reproducible example

https://codesandbox.io/s/confident-pasteur-30gc2q

Suggested solution

Manually handling focus trap as suggested here works
#1498 (comment)

document.addEventListener('focusout', (event) => {
  if (event.relatedTarget === null) container.focus();
})

Additional context

Related issue: #1498 (comment)

This works fine on other OS.

Your environment

Software Name(s) Version
Radix Package(s) Dialog 1.0.0
React n/a 17
Browser Chrome (MacOS) 103.0.5060.53
Assistive tech
Node n/a
npm/yarn
Operating System MacOS all

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions