vim-vixen icon indicating copy to clipboard operation
vim-vixen copied to clipboard

Fix opaque console iframe overlaying some websites

Open jessarcher opened this issue 2 years ago • 49 comments

This PR fixes the following issue where the console iframe is not transparent on sites that specify a color-scheme, such as GitHub:

image

The issue is caused by a change in Firefox where it will now make iframes opaque if their color-scheme differs from the parent page. The Vim Vixen iframe currently doesn't specify a color-scheme, but sites like GitHub do, hence the issue.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1738380 and https://fvsch.com/transparent-iframes

This PR makes two changes to solve this:

1. Set the appropriate color-scheme on the console.

The ConsoleFramePresenter gets the computed color-scheme for the <body> tag where the <iframe> will be injected and passes it to the console page via a query string parameter.

The console page takes the query string parameter and updates the colorScheme style property on the root element.

While this does fix the issue once the page has loaded, the white overlay is still briefly visible while it's loading.

I tried several methods to set the color-scheme but this was the only way I could set the value with the cross-origin of the <iframe>. I'm open to alternatives.

2. Shrink the <iframe> when not in use.

To hide the white overlay while the page is loading, I've set the initial height of the <iframe> to 0px. The useAutoResize hook already sets the correct height on the <iframe> once the user triggers it.

While not strictly necessary, I've also set the <iframe> height back to 0px when the console is closed. This solves a minor issue I've had during web development where the browser element selector will highlight the invisible Vim Vixen <iframe> at the bottom of the page which makes it hard to select items underneath it.

The shrinking of the <iframe> makes setting the color-scheme almost unnecessary. However, I've left it for a few reasons:

  1. When closing the console, occasionally I was able to see the white background briefly before the resize kicks in.
  2. When the console is open, there is a thin white line visible above it. This could probably be solved with CSS.
  3. Making the background transparent is presumably valuable for those with a semi-opaque console background theme.

Fixes #1424 Fixes #1429 Fixes #1433

jessarcher avatar Jul 06 '22 11:07 jessarcher

For anyone that wants to try this, you can build my branch as follows. You will need Git, Node, Yarn, and a Firefox edition that supports unsigned addons. Make sure you understand the risks before continuing.

git clone [email protected]:jessarcher/vim-vixen.git
cd vim-vixen
git checkout fix-console-bg
yarn install
yarn package

This should create a vim-vixen-1.2.4.zip file in this directory which you can install from about:addons.

Again, only do this if you understand and accept the risks of enabling unsigned addons and always compile from source!

jessarcher avatar Jul 06 '22 11:07 jessarcher

@ueokande I'm also considering opening a PR for #111. Can you let me know if you're welcoming PRs here?

ditsuke avatar Jul 08 '22 06:07 ditsuke

Just installed this patch and it seems to be working. Thanks @jessarcher

danjones1618 avatar Jul 08 '22 12:07 danjones1618

Also confirm this looks good. I don't really see any other means of communicating the color-scheme to the iframe, either. This LGTM.

jsoo1 avatar Jul 11 '22 17:07 jsoo1

Installed and works as intended. Thanks for the fix.

cdbrkfxrpt avatar Jul 15 '22 09:07 cdbrkfxrpt

i have a question, when this PR will be merge ?

LordPax avatar Jul 18 '22 14:07 LordPax

How do you install the add-on? I've disabled xpinstall.signatures.required but still getting not verified error. On latest macOS and Firefox 102.0.1.

johalun avatar Jul 21 '22 17:07 johalun

@johalun it's because you dont use developer version of firefox

LordPax avatar Jul 21 '22 17:07 LordPax

You can migrate to the dev version using your normal FF profile by doing firefox -p

danjones1618 avatar Jul 21 '22 17:07 danjones1618

Thanks for the clarification. I don't wanna mess anything up so I'll just wait for this to be merged.

johalun avatar Jul 21 '22 17:07 johalun

The developer of this plugin seems to be inactive :/ maybe we need a community fork?

xeruf avatar Jul 22 '22 11:07 xeruf

To all that complain: can we please cut some slack to the project maintainer(s)? Being passionate about this project does not mean that entitled comments are fine either.

There are some workarounds explained in the comments, there is a patch ready for review that can be applied with some legwork. There are even alternatives to this extensions.

This is a FOSS project I've been happily using for free out of the goodwill of the maintainer(s) and by no means I expect them to service me like I'm a paying customer.

jman-schief avatar Jul 22 '22 12:07 jman-schief

The developer of this plugin seems to be inactive :/ maybe we need a community fork?

Too soon for calling the repo dead. My guess is that they're prolly on vacation. It is the middle of summer after all.

applejag avatar Jul 22 '22 13:07 applejag

either way it would be good to have co-maintainers for a project as big and good as this ;)

xeruf avatar Jul 22 '22 14:07 xeruf

To all that complain: ...

I don't see any complaints, rather suggestions on how to avoid disruptions in development. There's nothing wrong with having multiple maintainers for a project that many depends on in their daily life/work. It would also take stress and burden off the main developer.

johalun avatar Jul 22 '22 17:07 johalun

What is missing to get this PR merged?

weilbith avatar Aug 24 '22 07:08 weilbith

What is missing to get this PR merged?

The maintainer?

toastal avatar Aug 24 '22 08:08 toastal

The maintainer posted a blog post 6 days ago, so he's definitely alive.

Update: I've messaged him directly on Twitter.

fosskers avatar Aug 26 '22 05:08 fosskers

@fosskers Any luck there? Wondering if a fork is prudent. Thank you for your work! And thanks @jessarcher!

ryanisnan avatar Sep 03 '22 04:09 ryanisnan

He hasn't responded. I happen to live in the same city as him and he has publicly posted his workplace. Should I just go in person and leave him a message? Would that be creepy? Please vote, I have no natural sense for these things, I just want the damn extension fixed hahah.

fosskers avatar Sep 03 '22 04:09 fosskers

😆, No, definitely do not go and do that. Perhaps we can request that someone else be temporarily added as a maintainer, and if that fails, someone can fork this project. I love this add-on!

ryanisnan avatar Sep 03 '22 04:09 ryanisnan

Roger. I'll sit tight. But how to request that someone else be added if he's not responding anywhere?

fosskers avatar Sep 03 '22 04:09 fosskers

Any ff add-on dev here who wouldn't mind forking and publishing a fix? The developer clearly isn't committed to this project at the moment (which is fine, things change people move on etc). But, would be nice if the project survived / didn't rot too much. If the maintainer resurfaces and is committed they can always backport updates from the fork.

johalun avatar Sep 19 '22 16:09 johalun

We might be at the stage where a fork is necessary.

fosskers avatar Sep 20 '22 03:09 fosskers

Hey @fosskers is there any news about What's happened with the PR merge status or about the fork that you mentioned? It's pretty strange that the solution is there but nobody merged it

codeDude64 avatar Oct 13 '22 00:10 codeDude64

At this point someone will have to volunteer to manage a fork of the project. I just started a new job and have many other FOSS projects, so it would be irresponsible of me to personally volunteer.

fosskers avatar Oct 13 '22 01:10 fosskers

I suspect part of the problem is that no single person wants to put their hand up to take on the project. As demonstrated by the comments on this PR, we clearly have an engaged community using this fantastic extension, and many hands make light work, as the expression goes.

Are there people here that would be willing to help co-manage a fork?

Edit: Add a thumbs up here if you'd like to join the wonderful team of volunteers. 🙌

nattyg93 avatar Oct 13 '22 01:10 nattyg93

@nattyg93 I've been a developer for a lot of time but I've never participated in an open-source project, I think that It's a good opportunity for me. I'm in

codeDude64 avatar Oct 13 '22 07:10 codeDude64

@LordPax I'll take that thumbs up react to mean you're volunteering?

I'm in much the same position as @codeDude64 - I've never participated in an open-source project (other than contributing an occasional PR). It would be fantastic to have a volunteer with some experience working on a team to manage an open-source project. Any takers?

nattyg93 avatar Oct 13 '22 22:10 nattyg93

Professional front-end developer for over 5 years now, love open source, I could help with some code review or something if you need me? Sign me up.

victorz avatar Oct 13 '22 22:10 victorz