- Go to about:config in firefox
- Note that you will need to accept the risk warning so abort if you're not comfortable[1]
- In the filter input field type "fullscreen"
- You should have the option of
browser.fullscreen.exit_on_escape - Make sure it's set to false.
[1] This particular change is not very risky however there are other settings that can be changed here that are not so innocent. Make sure that you're careful in this environment and don't just apply anything you read on the internet.
I use the escape key a lot for all sorts of things and Firefox is the only browser that exists from fullscreen like this. For various browser or web page popups the escape button can be a quick way of getting rid of these.