Skip to content

DOM node focus lost on set to disabled but Focus remains on Focusable Element #166

@stuartflanagan

Description

@stuartflanagan

Describe the bug
When using shouldFocusDOMNode initial focus works as expected. If for some reason actual focus is lost. This happens if a button element is set to disabled while fetching data or a mouse click in another area of the DOM via LG Magic Remote, then focus remains on the button from useFocusable but the underlying DOM node has lost focus.

To Reproduce
Steps to reproduce the behavior:

  1. Set new INIT with shouldFocusDOMNode true.
  2. Create a focusable element with useFocusable with a button
  3. Programatically set button element to disabled: true and then back to disabled: false
  4. The focus still appears to be on the correct Button but no onEnterPress methods will fire.

Expected behavior
Expect visual focus and focused property from useFocusable to reflect actual state.

I assume this is not trivial to do, as the DOM focus is not tracked as part of the library.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions