Skip to content

[field] Focus state inaccurate on initial render when Field.Control has autoFocus #3172

@kenanyusuf

Description

@kenanyusuf

Bug report

Current behavior

I am using the Field component and passing the autoFocus prop to the Field.Control. state.focused is false and data-focused is not present on the initial render.

Expected behavior

I expected state.focused to be true and data-focused to be present on the field elements.

Reproducible example

https://codesandbox.io/p/devbox/ts8md6

Steps to reproduce:

How it looks:

Image

How it should look:

Image

Base UI version

v1.0.0-beta.4

Which browser are you using?

Chrome

Which OS are you using?

Mac OS

Additional context

I suspect this may be related to server-side rendering. The reproduction of the issue is using SSR and Next.js, whereas this version is client-rendered and working as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: fieldChanges related to the field component.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions