menus.ContextType editable does not match a <selection> (dropdown)

Hi I am writing an extension that allows password and other data to be entered on input fields, by picking a context menu option created with contexts: [“editable”].
This works fine for input fields, but the menu option does not appear when right clicking on a field.
Thus I seem to have to use contexts: [“all”] which means the menu also appears when clicking on a non input capable element which is confusing.

I seem to recall that this once worked (some years back) - is this an oversight or am I missing something?

Thanks

1 Like

In the docs compatibility it’s written that:

'The ‘editable’ context does not include password fields. Use the ‘password’ context for this.

<select>s aren’t password fields though…

1 Like

Yeah, I’m not a very sharp reader :smiley:. Who is reading a heading? LOL!

Also his question was a bit vague, it really “felt” like he is asking for password field (and just forget the word “password”).

Anyway, so select doesn’t count as editable, which makes sense I guess…

I disagree - a can have its value changed by a human viewer just as a text area can be written into, so in that regard it is editable.

Certainly in my use case there is a need for either another ContextType or to regard the select as editable. My extension will populate entry fields on a page with credit card information (and others). Initially all fields are looked at and fields have their value changed to (for example) card expiry date depending on the field id and name. This works well. However some pages have weird names on fields so there is also a need to click on an individual field and state what card information should be used. Expiry dates are often shown as month and year in a dropdown .
Thus I am forced to use contexts: [“all”] which means the menu also appears when clicking on a non input capable element. This looks weird and I cannot see an other way to avoid it.

Maybe you can try to modify the page elements into something you can match?

Out of box idea - setting contenteditable to true on those select boxes :slight_smile:.

BTW, how does it behave in other browsers?

the editable context is for areas where text is editable, so where the execCommand features work etc. That is how the web generally treats “editable”.

You can hide/show the item during https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/onShown

1 Like

I did not notice that possibility and will give that a go
Thank you