Skip to content

[field] data-focused attribute persists when data-disabled #3987

@DavidCodina

Description

@DavidCodina

Bug report / Feature request

With native HTML <input> and <button>, the elements are not focusable when disabled. Arguably, the same behavior should be reflected in the Base UI form components like Field, Input, Select, Autocomplete, Combobox, etc. This could be achieved by removing data-focused when data-disabled is added.

The current Tailwind workaround is to use a not-data-disabled:data-focused: ... modifier, or focus-visible: ... in cases where that would actually work instead. However, I don't think this is something consumers should have to implement. I don't think users expect data-focused to persist when data-disabled.

I do like that the Button component has the focusableWhenDisabled prop and it correctly defaults to false. This could be added to the form-related components, but I don't think there's a strong need. The primary issue is simply the persistence of data-focused.

Thanks for your help.

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