Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Proper way to autofocus a Text field in a Dialog?Β #2154

Closed
@jonvuri

Description

Question

What is the proper way to autofocus a Text field in a Dialog?

This is an unorthodox issue, I know, but I've been wrestling with various ways to tackle this for quite some time now and I'm stumped. The use case for this is a dialog being popped up to rename one item in a list, upon clicking a button. This involves a simple dialog with a single text input, a cancel button, and an accept button. All the usual ways to manually focus or autofocus a text field or directly on the input either don't work, or focus it briefly then immediately unfocus - I realized after some research that this is due to the focus trap the dialog is setting up. However, there doesn't seem to be any way to configure that focus trap to focus any element of the dialog aside from the accept button. Does such a way exist? Or am I going about this the wrong way?

Metadata

Assignees

No one assigned

    Labels

    Unresolved (Archived)Open and unresolved issues and PRs that were closed due to archiving the repository.backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions