Skip to content

Prevent disabled Inputs from being edited #8238

@nickofthyme

Description

@nickofthyme

Describe the bug
When using LastPass or similar password management tools. Eui does not prevent these tools from editing disabled input values. This results in edited disabled values being saved. However, applying readonly does block the input value from being updated.

Environment and versions

  • EUI version: latest

To Reproduce
Steps to reproduce the behavior:

  1. Create an EuiFieldText input with the name attribute set to 'username'.
  2. Set input to disabled
  3. Download any password manager
  4. Create a password record on the current page
  5. Refresh and fill the input using the password manager.
Zight.Recording.2024-12-13.at.01.45.53.PM.mp4

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

Expected behavior
Disabled inputs should never be editable.

Additional context

Attempting to use the solution from https://stackoverflow.com/a/28216951/6943587 does not work. Applying autocomplete="off" to the input and/or form, does not prevent the update of the input value.

Every solution I tried always resulted in the onChange handler being called. The most foolproof solution is to set readOnly whenever disabled is set, unless overridden by the user.

Metadata

Metadata

Assignees

Labels

low hanging fruitAn issue, often a bug, that is lower effort and clearly ought to be fixed

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions