clients icon indicating copy to clipboard operation
clients copied to clipboard

Unable to identify a valid form element. Try inspecting the HTML instead.

Open DavidPesticcio opened this issue 1 year ago • 3 comments

Steps To Reproduce

  1. Visit to https://lucid.app/users/login#/login
  2. Right click on the checkbox or "Remember me" text.
  3. Select "Bitwarden | Copy custom field name"
  4. Paste buffer now contains "Unable to identify a valid form element. Try inspecting the HTML instead."

Upon inspecting the HTML, there does not appear to be the usual form element name.

Is this a bug, or something that cannot be catered for by Bitwarden, or should this should be a feature request?

Regards.

Expected Result

A copy of the form element should be in the paste buffer.

Actual Result

Paste buffer contains "Unable to identify a valid form element. Try inspecting the HTML instead."

Screenshots or Videos

N/A

Additional Context

I don't this this is actually a bug, but rather a quirk of how lucid.app handles a checkbox.

Operating System

Linux

Operating System Version

Linux 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Web Browser

Chrome

Browser Version

Version 115.0.5790.110 (Official Build) for Linux Mint (64-bit)

Build Version

2023.7.0

Issue Tracking Info

  • [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

DavidPesticcio avatar Aug 18 '23 14:08 DavidPesticcio

Hi there,

Thank you for your report!

I was able to reproduce this issue, and I have flagged this to our engineering team.

If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these.

Thanks once again!

jtodddd avatar Aug 21 '23 14:08 jtodddd

I checked this out, and it looks like there are two problems that are causing this.

  1. The input element is wrapped in a <label> (without a for attribute). Because getClickedElementIdentifier() in autofill/content/context-menu-handler.ts only checks for the nearest label element and tries its for attribute, it won't find the input element when it's a child of the label element.

One potential fix for this problem would be to check children for potential input elements rather than only checking parents

  1. The input element doesn't have an id, name, aria, or placeholder attribute, so getClickedElementIdentifier doesn't find a unique attribute.

This could be fixed by looking for unique identifiers in the data attributes, which this input element has. But I'm not sure if these would be valid identifiers for a custom field.

If these are adequate solutions, I'd be happy to implement these fixes and make a pull request

connercsbn avatar Oct 29 '23 23:10 connercsbn

I'm, having a similar issue with the password box at https://www.britishgas.co.uk/identity/ (the username input works okay). In this case, there is a suitable for label (which contains "Password"), but it isn't identified, possibly because there is a show / hide button implemented as a label in between. If this is the case, and work is being done in this area, perhaps searching more widely for an associated label would help this and other sites which use a similar layout.

Perhaps out of scope for this issue, but It would be great if custom field links could be added to matching items directly from the right-click menu, rather than the current, "copy name -> open item -> edit item -> create link -> paste name" chain. I came from Dashlane (which can do this) and Bitwarden's process is a substantial increase in friction for this feature, to the extent that I didn't even realise it was possible for a while.

BobSammers avatar May 07 '24 09:05 BobSammers