Skip to content

setFocus() requires a timeout in componentDidLoad() #5369

Closed
@AdelheidF

Description

@AdelheidF

Description

There is a change with setFocus in beta.94. The call itself works fine, but in the past I could just do this:

componentDidLoad(): void {
    this.panelNode.setFocus("back-button");
}

This no longer works. I have to add the setFocus() call into a timeout now. Not sure though what a reliable wait time is.

This is the case both for panel or flow-item, or if I want to set the focus on a close button I add myself. No difference there.

From @driskull

I think we can improve this in the future by setting up a promise internally and waiting for the component to load before resolving the promise and then setFocus would wait for that promise first.
But I think we can wait for the component to load before focusing internally.

Acceptance Criteria

setFocus should not require a timeout in componentDidLoad()

Relevant Info

No response

Which Component

panel, flow-item, ...

Example Use Case

No response

Esri team

N/A

Metadata

Metadata

Assignees

Labels

4 - verifiedIssues that have been tested, confirmed as mitigated, and are ready to close.ArcGIS Map ViewerIssues logged by ArcGIS Map Viewer team members.enhancementIssues tied to a new feature or request.estimate - 5A few days of work, definitely requires updates to tests.has workaroundIssues have a workaround available in the meantime.p - mediumIssue is non core or affecting less that 60% of people using the library

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions