Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent disabled Inputs from being edited #8238

Open
nickofthyme opened this issue Dec 13, 2024 · 0 comments
Open

Prevent disabled Inputs from being edited #8238

nickofthyme opened this issue Dec 13, 2024 · 0 comments
Labels
bug low hanging fruit An issue, often a bug, that is lower effort and clearly ought to be fixed

Comments

@nickofthyme
Copy link
Contributor

nickofthyme commented Dec 13, 2024

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.

@nickofthyme nickofthyme changed the title Prevent readonly and disabled Inputs from being edited Prevent disabled Inputs from being edited Dec 15, 2024
@JasonStoltz JasonStoltz added the low hanging fruit An issue, often a bug, that is lower effort and clearly ought to be fixed label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug low hanging fruit An issue, often a bug, that is lower effort and clearly ought to be fixed
Projects
None yet
Development

No branches or pull requests

2 participants