Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflicts between webextension styles and embedded lib styles in Safari #309

Open
balmas opened this issue Aug 11, 2020 · 2 comments
Open
Labels
safari safari-specific issues

Comments

@balmas
Copy link
Member

balmas commented Aug 11, 2020

The problem with the incorrect width of a treebank panel in Safari seems to be the conflict with the old version of the Safari App Extension. Whenever an extension is installed and active, it injects its own CSS stylesheets. Those styles has a higher priority than the styles loaded by the webpage.

In the Safari test, texts-test.alpheios.net was defining the width of the panel as 100% in its own styles (which is correct), but the extension was loading an older stylesheet, where the width is defined as 690px (incorrect). However, because of the higher priority of the extension's styles, 690px value prevailed.

@monzug, can you please verify that this is the case? Please go to Safari's Preferences, select an Extensions tab, and uncheck the box next to the Alpheios reading tools to disable the extension. Then reload the page. This should fix the issue.

Originally posted by @kirlat in alpheios-project/alpheios-core#507 (comment)

@balmas
Copy link
Member Author

balmas commented Aug 11, 2020

I think we would like people to be able to have the extension installed and use the texts environment. The extension should be automatically deactivated on a page with the embedded library and it would be better if it didn't load the stylesheets in the page when it's not activated. But maybe this will be resolved automatically if we switch to the web extension api compatible architecture in Safari. We can look into it when we work on that.

@balmas balmas added the safari safari-specific issues label Aug 11, 2020
@kirlat
Copy link
Member

kirlat commented Aug 11, 2020

The extension should be automatically deactivated on a page with the embedded library and it would be better if it didn't load the stylesheets in the page when it's not activated.

We can't unload the stylesheets at the current level of technologies. We do deactivate the extension (i.e. call the deactivate() method on the app controller) but that it not enough. In order to remove the extension's stylesheets from the page, we have to disable an extension in the Safari preferences. We cannot do that programmatically now. That makes sense due to security reasons: why would a page (a JS code on a page) be allowed to turn off extensions installed in the browser?

Maybe the new extension architecture will change some things here. Maybe they will not inject stylesheets automatically and will delegate that to the extension's code as in webextensions. But I'm not holding my breath, even though hoping for that secretly 🙂.

If stylesheets injected by the webextension and the app extension are of the same version, we have no problem. Issues start when there is a version mismatch. We maybe can detect that and give user a warning asking him or her to disable the app extension but I'm not sure if it'll make a good UX. We can wait to see how the thing will unfold with the new extension model in Safari 14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safari safari-specific issues
Projects
None yet
Development

No branches or pull requests

2 participants