Skip to content

fix(ui): bitwarden auto complete not working for local login #4088

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Zebebles
Copy link
Contributor

Description

As described in the linked issue, Bitwarden just looks for the existence of the data-bwignore attribute rather than what its value is. Therefore, the data-bwignore="false" in LocalLogin.tsx results in Bitwarden ignoring the field.

This PR addresses that by replacing the data-xxignore attributes with a single allowAutoComplete prop that conditionally includes these attributes when false or undefined.

I also enabled auto complete on 'new password' fields across the ui as most password managers have a generate password popup for these.

To-Dos

  • Successful build yarn build
  • Translation keys yarn i18n:extract

Issues Fixed or Closed

@Zebebles
Copy link
Contributor Author

@s0up4200 FYI

@s0up4200
Copy link
Contributor

@s0up4200 FYI

Looks clean! Thanks for fixing my mess 😄

Comment on lines +35 to +42
{...(allowAutoComplete
? {}
: {
autoComplete: 'off',
'data-1pignore': 'true',
'data-lpignore': 'true',
'data-bwignore': 'true',
})}
Copy link

@SimplyLinn SimplyLinn Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{...(allowAutoComplete
? {}
: {
autoComplete: 'off',
'data-1pignore': 'true',
'data-lpignore': 'true',
'data-bwignore': 'true',
})}
autoComplete={!allowAutoComplete ? 'off' : undefined}
data-1pignore={!allowAutoComplete || undefined}
data-lpignore={!allowAutoComplete || undefined}
data-bwignore={!allowAutoComplete || undefined}

The original syntax is a bit ugly and hard to read, also the "data-1pignore" was duplicated Actually, no, it was lpignore - lowercase L instead of , added it back in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why the object spreading / ternary mix could be considered ugly and hard to read if someone's coming across it for the first time.

I still stand by it, as I think that the final value of the data-props is clearer at a glance than the boolean expressions.
It also keeps all of the effects of the allowAutoComplete prop organised and contained.

Maybe an alternative change to improve readability would be to keep the values in a const instead?

Let me know what you think. Happy to change it if others agree with you

const PREVENT_AUTOCOMPLETE_PROPS = { // At top of file with type defs
	autoComplete: 'off', 
	'data-1pignore': 'true', 
	'data-lpignore': 'true', 
	'data-bwignore': 'true'
};

<Component
	{...(allowAutoComplete ? {} : PREVENT_AUTOCOMPLETE_PROPS)}
  	{...componentProps}
     className={`rounded-l-only ${componentProps.className ?? ''}`}
/>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to change this. I like the object spread! Looks cleaner to me.

@gauthier-th
Copy link
Contributor

Related to fallenbagel/jellyseerr#1487

@Zebebles Zebebles force-pushed the fix/bitwarden-doesnt-autofill branch from aa4f3dd to b0e4a9b Compare April 15, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Password manager (Bitwarden) does not autofill password for local login.
5 participants