Along with the release of Firefox 57 comes the photon-ui. This new version moves the refresh button back out of the URL bar, like it was back in… Firefox 3.6? Hmm, seems like a ~7 year cycle… We going to get it back in the URL bar in 7 years? … Anyway…
So, I decided to make a small WebExtension utilizing the ‘PageActions’ in order to replicate the functionality. I’ve got everything working (btw, I also wish there was a ‘stop all stuff loading in this tab’ API call, but there isn’t…), except for a small visual nitpick.
When I select the URL bar I would like to be able to hide the PageAction button that I created, much like how the builtin PageActions disappear when entering the URL bar. However, there is no event in which I can attach a listener too. All the URL bar events require that I attach some kind of ‘keyword’ that needs to be typed before they get called.
Is there any existing APIs in which I can use to hide/unhide the PageAction button on URL focus/unfocus?
Wow, thanks. I don’t know why I didn’t think of that. Considering I did much of the same to transform the hamburger menu button into the orange button (located in the top left) from Firefox 4-28.
This doesn’t quite solve the above visual nitpick but it does make for an overall better button and it’s way less janky on page reload. Since pageActions are disabled by default I’d have to run the .show() for every navigation causing flickering.
This still isn’t quite the same as the other buttons in there, but pretty close. I’d experiment further, but for some reason, Firefox refuses to open the Browser Toolbox now -.-
I didn’t know about the ‘focus-within’ selector, nice! That actually helps with some other projects I’ve been working on.
I had this issue too. Turns out it’s something to do with your profile (perhaps a lock file?). When it occurred I’d create a new profile. However, in order to mitigate it, actually I haven’t seen the issue since I started this, make sure you close the browser toolbox manually, wait a few seconds, then quit the main browser.
As a quick file check. Here’s some results (on Windows, should be similar on other platforms).