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

browser_style deprecated in MV3 #26642

Merged
merged 13 commits into from May 22, 2023
Merged

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented May 8, 2023

Description

Provides documentation for Bug 1827910 "Deprecate browser_style in MV3"

@rebloor rebloor added the Content:WebExt WebExtensions docs label May 8, 2023
@rebloor rebloor requested a review from Rob--W May 8, 2023 08:06
@rebloor rebloor requested a review from a team as a code owner May 8, 2023 08:06
@rebloor rebloor self-assigned this May 8, 2023
@rebloor rebloor requested a review from a team as a code owner May 8, 2023 08:06
@rebloor rebloor requested review from hamishwillee and removed request for a team May 8, 2023 08:06
@github-actions github-actions bot added the Content:Other Any docs not covered by another "Content:" label label May 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

Preview URLs (15 pages)
External URLs (15)

URL: /en-US/docs/Mozilla/Firefox/Releases/114
Title: Firefox 114 for developers


URL: /en-US/docs/Mozilla/Firefox/Releases/115
Title: Firefox 115 for developers


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages
Title: Extension pages


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages
Title: Options page


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Page_actions
Title: Address bar button


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles
Title: Browser styles


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Popups
Title: Popups


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/Work_with_contextual_identities
Title: Work with contextual identities

(comment last updated: 2023-05-22 17:17:44)

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to create a sample in mdn/webextensions-examples that shows how to migrate from MV2 + browser_style to MV3? Or should I provide these and let you link it from here?

@@ -87,7 +88,7 @@ The `action` key is an object that may have any of these properties, all optiona
consistent with the browser's UI and with other extensions that use
the <code>browser_style</code> property. Although this key defaults to
<code>false</code>, it's recommended that you include it and set it to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not recommended to include it since support will be dropped. Reword this in every article. To avoid repetition consider relying on the canonical browser_styles article.

> **Note:** **Google Chrome** and **Opera** use `chrome_style` instead of `browser_style`, so if you wish to support them, you need to add both keys.
> **Warning:** When `browser_style: true` is included in your web extension's manifest, text selection in your extension's UI is disabled except in input controls. If this causes a problem, include `browser_style:false` instead.

> **Note:** **Google Chrome** and **Opera** use `chrome_style` instead of `browser_style`, so you need to add both keys to support them.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chrome_style support was removed from MV3.

When considering using `browser_style: true`, you need to test your extension with various themes (built-in or from AMO) to make sure that the extension UI behaves the way you expect it to.
> **Note:**
> Support for `browser_style` in Manifest V3 has been deprecated and, from Firefox 115, `options_ui.browser_style` and `sidebar_action.browser_style` default to `false`. `page_action.browser_style`, `browser_action.browser_style`, and `action.browser_style` already defaults to `false`.
> If your Manifest V3 extension depends on the `browser_style: true` styles, bundle this stylesheet in the extension: [extension.css](https://hg.mozilla.org/mozilla-central/raw-file/a445f1762c895000bcdabd9d95697522359d41ed/browser/components/extensions/extension.css).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeat this recommendation and reference to the stylesheet in the Firefox panel components section at the bottom of this article.

Could you introduce a new section, Migrating away from browser_style? for example for options_ui (most common case since browser_style there used to default to true):

  1. set options_ui/browser_style to false. If nothing happened, just remove the key.
  2. if the appearance of the page changes, try to see what dependency there is, and put the relevant properties in the extension's stylesheet. In the bug I explained in detail which styles are most likely going to potentially cause (or not cause) issues.
  3. if one cannot figure out step 2, try including the content of extension.css with the extension and delete all parts that aren't relevant. Most extensions won't use browser-style class, so it's mainly the two blocks I annotated in the bug.

@rebloor
Copy link
Contributor Author

rebloor commented May 15, 2023

@Rob--W

Are you able to create a sample in mdn/webextensions-examples that shows how to migrate from MV2 + browser_style to MV3? Or should I provide these and let you link it from here?

I'd be happy to do this. However, I suspect I might need quite a bit of your time to devise and fine-tune the example. Also, do we have a plan for how to include MV2 and MV3 examples?

@rebloor rebloor requested a review from Rob--W May 18, 2023 00:04
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented in action specifically because it is even more special; please update the page_action, options_ui, sidebar_action to remove the repetition of what browser_style does, and refer to the /en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles page instead. And emphasize that browser_style support will be dropped.

The default changing from true to false is merely a transition tool, it is very much the intention to turn off support.

rebloor and others added 2 commits May 19, 2023 15:53
@rebloor rebloor requested a review from Rob--W May 19, 2023 04:17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 29: remove browser_style from the example.

This also applies to the browser_action and page_action articles.

</p>
<div class="notecard warning">
<p>
Do not set `browser_style` to true: it is deprecated in Manifest V3, and support will be removed in Firefox 118. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles#manifest_v3_migration">Manifest V3 migration for `browser_style`</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backticks are somehow not rendering here. Let's use <code> tags instead.

This also applies to the other sections with the same issues (see the previews at #26642 (comment) )

<p>
Do not set `browser_style` to true: it is deprecated in Manifest V3, and support will be removed in Firefox 118. See <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles#manifest_v3_migration">Manifest V3 migration for `browser_style`</a>.
</p>
</div>
<p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything else in this cell (besides the depreciation notice above), until the closing </div>. The information is not relevant and should not occupy that much space.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 29: remove browser_style from example.

browser_style
</a>
</code>
<br />{{optional_inline}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other keys are also optional. For consistency, add this label to the other action keys.

browser_style
</a>
</code>
<br />{{optional_inline}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other keys are optional, add the optional label to browser_action keys for consistency.

browser_style
</a>
</code>
<br />{{optional_inline}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, add optional to every other key except for default_panel.


When considering using `browser_style: true`, you need to test your extension with various themes (built-in or from AMO) to make sure that the extension UI behaves the way you expect it to.
> **Note:**
> Support for `browser_style` in Manifest V3 is deprecated. Starting from Firefox 115, the default value of `options_ui.browser_style` and `sidebar_action.browser_style` changes from `true` to `false`. In Firefox 118, `"browser_style": notrue` will no longer be supported in Manifest V3 extensions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Support for `browser_style` in Manifest V3 is deprecated. Starting from Firefox 115, the default value of `options_ui.browser_style` and `sidebar_action.browser_style` changes from `true` to `false`. In Firefox 118, `"browser_style": notrue` will no longer be supported in Manifest V3 extensions.
> Support for `browser_style` in Manifest V3 is deprecated. Starting from Firefox 115, the default value of `options_ui.browser_style` and `sidebar_action.browser_style` changes from `true` to `false`. In Firefox 118, `"browser_style": true` will no longer be supported in Manifest V3 extensions.

@@ -91,7 +95,7 @@ The `options_ui` key is an object with the following contents:
href="https://acorn.firefox.com/latest/acorn.html"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recommendation does not make sense in the context of browser_style. That page provides the resources (assets) to mimic the latest browser styles, but that is completely independent of the browser_style styles.

Let's keep the references to the "browser styles" article, and expand the article with a section that references acorn for people interested in that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment here also applies to sidebar_action and page_action, which has similar text.

@rebloor rebloor requested a review from Rob--W May 20, 2023 18:01
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+, with the requested change to page_action and sidebar_action applied.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you've already mentioned the changed default, there is no mention of it in the release notes. Could you mention that the default of options_ui.browser_style and sidebar_action.options_ui changed from true to false for Manifest Version 3 extensions (and reference the browser_styles article with the deprecation guidelines)? If you'd like that can also be a follow-up PR. That release note should be associated with https://bugzilla.mozilla.org/show_bug.cgi?id=1830710

In any case, this is good to merge.

Co-authored-by: Rob Wu <rob@robwu.nl>
@rebloor rebloor merged commit e1a6767 into mdn:main May 22, 2023
3 checks passed
@rebloor rebloor deleted the Deprecate-browser_style-in-MV3 branch May 22, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Other Any docs not covered by another "Content:" label Content:WebExt WebExtensions docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants