Skip to content

[Inputs] Styles should prioritize disabled over readOnly #8239

Description

@nickofthyme

Is your feature request related to a problem? Please describe.

Related to #8238, a solution to this would be to set readOnly whenever disabled is set, so something like this...

const MyCustomInput = ({ disabled, readOnly }) => (
  <input
    type="text"
    disabled={disabled}
    readOnly={readOnly ?? disabled}
  >
)

The issue in this case is that the current styles prioritize readOnly whenever both readOnly and disabled are applied together.

Image

See demo https://codesandbox.io/p/sandbox/adoring-christian-jk8t45

Describe the solution you'd like

The input styles prioritize disabled over readOnly. This is the same behavior as the basic html input.

Describe alternatives you've considered

An alternate fix to #8238 would be to just check disabled before triggering onChange from a consumers perspective, but this is not ideal.

Desired timeline
Unknown

cc: @MichaelMarcialis

Activity

  1. added
    design decision
    on Dec 13, 2024
  2. added
    help wanted
    on Dec 17, 2024
  3. github-actions commented on Dec 17, 2024

    @github-actions

    👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.

  4. JasonStoltz commented on Dec 17, 2024

    @JasonStoltz
    Contributor

    We estimated this as a Large size effort because of the potential impact on Kibana and the potential to break a large number of FTR tests.

  5. nickofthyme commented on Jan 13, 2025

    @nickofthyme
    ContributorAuthor

    @JasonStoltz That does not appear to be true.

    I made the changes in #8271 then built, packed and install them in kibana, see elastic/kibana#206372. The CI passed just fine, minus a few flaky tests.

    In general, I don't think tests assert the applied styles, rather they assert that the attribute is present.

    expect(getByText(/Click me/i).closest('button')).toBeDisabled();
  6. self-assigned this
    on Jan 13, 2025
  7. tkajtoch commented on Jan 14, 2025

    @tkajtoch
    Contributor

    After revisiting this issue, I think we should just go forward and prioritize readonly over disabled look and feel to match the native UI. This is a small effort.

    @MichaelMarcialis just to make sure - are you fine with this change from the design point of view?

  8. added
    low hanging fruit
    on Jan 14, 2025
  9. MichaelMarcialis commented on Jan 21, 2025

    @MichaelMarcialis
    Contributor

    After revisiting this issue, I think we should just go forward and prioritize readonly over disabled look and feel to match the native UI. This is a small effort.

    @MichaelMarcialis just to make sure - are you fine with this change from the design point of view?

    If you mean "prioritize disabled over readonly" (assuming the above is a typo), then yes, I'm fine with this change from a design perspective. CCing @ek-so as well, in case this has any impact on her form work with Borealis.

  10. nickofthyme commented on Jan 21, 2025

    @nickofthyme
    ContributorAuthor

    Yes prioritizes disabled over readonly. See #8271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design decisionhelp wantedlow hanging fruit

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions