msaroff
(Matthew G. Saroff)
December 17, 2018, 5:30am
1
According to the docs on menus.create , the use of the ampersand (&) to create an access keys has only been implemented in FF 63 and later.
So, if I create a menu like with a title like this:
Plaster of &Paris Bagel and Cream Cheese Paperweight
In FF 63 and later, it will appear as:
Plaster of P aris Bagel and Cream Cheese Paperweight
And hitting the “P” key will activate that menu.
But in earlier versions, (FF ESR) it will appear as:
Plaster of &Paris Bagel and Cream Cheese Paperweight
What is the preferred solution to handle this display issue? (Obviously, I cannot implement the functionality pre 63)
For Firefox:
await browser.runtime.getBrowserInfo().then(info => parseInt(info.version)) >= 63 ? 'text with &' : 'text without &'
msaroff
(Matthew G. Saroff)
December 17, 2018, 6:27pm
3
OK, thanks.
Since I only want to do this once, and not for each menu, I would make a variable, and incorporate it into the menu as needed.
msaroff
(Matthew G. Saroff)
December 17, 2018, 7:05pm
4
Also, is there a permission that I need to add to the manifest to use getBrowserInfo()?
Nope, it would be mentioned in the docs. But right now it’s for Firefox only - if you would like check Chrome version, you would have to parse the userAgent
string.