Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Using '%s' to add selected text in the context menu adds '...' to the end of the selected text, how do I get rid of it and why does this happen?

  • 2 ŋuɖoɖowo
  • 1 masɔmasɔ sia le esi
  • 11 views
  • Nuɖoɖo mlɔetɔ ThiefZero

more options

I'm trying to use '%s' to show the user marked text in the context menu in my newly created Webextension/addon.

This page: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/create stated that it would literally show the marked text.

"You can use "%s" in the string. If you do this, and some text is selected in the page when the context menu is shown, then the selected text will be interpolated into the title. For example, if title is "Translate '%s' to Pig Latin" and the user selects the word "cool", then activates the context menu, then the context menu item's title will be: "Translate 'cool' to Pig Latin"."

It, however, adds '...' to the selected text. I've already updated the MDN page to reflect my findings: (...)context menu item's title will be: "Translate 'cool...' to Pig Latin".

I've already tried everything, truncation, string replacement, none of it is working because '%s' in the title field is evaluated last.

More info: https://stackoverflow.com/questions/4376167/text-selection-and-display-in-context-menu-chrome-extension

Extra testing: I've tried using '%s' in chrome and it works flawlessly there. Not sure why Firefox is not playing along.

Please help, it's driving me nuts. Thank you.

Sincerely,

I'm trying to use '%s' to show the user marked text in the context menu in my newly created Webextension/addon. This page: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/create stated that it would literally show the marked text. "You can use "%s" in the string. If you do this, and some text is selected in the page when the context menu is shown, then the selected text will be interpolated into the title. For example, if title is "Translate '%s' to Pig Latin" and the user selects the word "cool", then activates the context menu, then the context menu item's title will be: "Translate 'cool' to Pig Latin"." It, however, adds '...' to the selected text. I've already updated the MDN page to reflect my findings: (...)context menu item's title will be: "Translate 'cool...' to Pig Latin". I've already tried everything, truncation, string replacement, none of it is working because '%s' in the title field is evaluated last. More info: https://stackoverflow.com/questions/4376167/text-selection-and-display-in-context-menu-chrome-extension Extra testing: I've tried using '%s' in chrome and it works flawlessly there. Not sure why Firefox is not playing along. Please help, it's driving me nuts. Thank you. Sincerely,

Ŋuɖoɖo si wotia

Sorry to point you away, but support for WebExtensions can be found here:

Hope you get a quick answer from whichever one you choose.

Xle ŋuɖoɖo sia le goya me 👍 1

All Replies (2)

more options

Ɖɔɖɔɖo si wotia

Sorry to point you away, but support for WebExtensions can be found here:

Hope you get a quick answer from whichever one you choose.

more options

jscher2000 said

Sorry to point you away, but support for WebExtensions can be found here: Hope you get a quick answer from whichever one you choose.

Ah, thanks for guiding me further. I'll mark this as resolved and check those places out!