Skip to content

How to set my own focus within EuiContextMenu #8094

@vera

Description

@vera

EUI version: v88.5.4

I am using an EuiContextMenu with nested panels, similarly to the first example here: https://eui.elastic.co/#/navigation/context-menu

At the lowest nesting level, the panels contain input fields (e.g. text input). I'd like the input field to be autofocused when I navigate to one of those panels. However, currently, when I try to autofocus the input field (using autoFocus or inputRef.current.focus()), the focus is always stolen by the header link.

Image

I found this comment describing that the autofocus may be disabled by setting initialFocusedItemIndex={-1} #5942 (comment) but it seems that was not merged/does not work.

Is there any way to achieve my desired behavior? Thanks.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions