Event listener doesn't detect enter key

I’ve made a web extension and it opens an HTML page in a new browser window. I have an event listener that is supposed to listen for the enter key to be pressed, but it’s work. All of my other keyboard event listeners work, but not the enter key. It works when I run the HTML file outside of the extension though.

Does Firefox not allow us to listen for the enter key?

I suggest you file a bug report.

I have an "keypress" listener in one of my extensions that fires for the enter key just fine.
It works (at least) in tabs and panels containing a moz-extension:// ... .html.

Ok there was a typo in the code, which is why it wasn’t triggering an error on the browser console. However, the Javascript eval function is blocked in Firefox, but I need a function that does a string of math and counts order of operations.

What’s a good alternative to the eval() function?

What about something like this:

http://mathjs.org/docs/reference/functions/eval.html

Without having tested it, that seems like the thing you are looking for. And one would hope they aren’t using eval under the hood.

Besides, if we are talking about WebExtensions here and you didn’t change the defsult CSP, then eval/ new Function` should work. On the other hand it looks like you wand to eval user input, which is a horrible idea.