Skip to content

[Inputs] Styles should prioritize disabled over readOnly #8239

@nickofthyme

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

Metadata

Metadata

Assignees

Labels

design decisionUse this to flag an item that needs input from the design teamhelp wantedThe EUI team is unlikely prioritize. (Don't delete - used for automation)low hanging fruitAn issue, often a bug, that is lower effort and clearly ought to be fixed
No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions