Skip to content

emulation.setMediaFeaturesOverride#1076

Open
sadym-chromium wants to merge 47 commits into
mainfrom
sadym/emulation.setMediaFeaturesOverride
Open

emulation.setMediaFeaturesOverride#1076
sadym-chromium wants to merge 47 commits into
mainfrom
sadym/emulation.setMediaFeaturesOverride

Conversation

@sadym-chromium
Copy link
Copy Markdown
Contributor

@sadym-chromium sadym-chromium commented Feb 16, 2026

Addressing #750.

Allow for overriding media features.

Related specs:

I added a CSS spec patch until the CSS PR w3c/csswg-drafts#13549 is merged.


Preview | Diff

@sadym-chromium sadym-chromium marked this pull request as ready for review February 23, 2026 15:18
Comment thread index.bs
? userContexts: [+browser.UserContext],
}

emulation.MediaFeatures = {
Copy link
Copy Markdown
Contributor

@OrKoN OrKoN Feb 23, 2026

Choose a reason for hiding this comment

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

I am not a fan of this API as it requires changing WebDriver BiDi spec whenever there is a new media feature available in the underlying browser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since media query features generally support unknown values, e.g., in CSS rules or in the matchMedia API, I think it might be beneficial to just pass a list of media features to the browser without re-listing all possible feature names in the WebDriver BiDi's CDDL. WDYT @jgraham ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@lutien WDYT about this proposal?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we can ensure interoperability between the browsers if we don't specify the supported media features here, and we have to write wpt tests anyway for every feature.

Comment thread index.bs Outdated
Comment thread index.bs Outdated
sadym-chromium and others added 2 commits February 25, 2026 14:39
Co-authored-by: Alexandra Borovova <lutien@users.noreply.github.com>
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Copy link
Copy Markdown
Member

@lutien lutien left a comment

Choose a reason for hiding this comment

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

Thanks! I think it looks fine now

Comment thread index.bs
Comment on lines +330 to +331
text: media feature; url: #media-features
text: mf-name; url: #typedef-mf-name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The spec already exports these terms although, for <mf-name>, the correct way to reference the term is going to be with the <<mf-name>> shorthand syntax.

Suggested change
text: media feature; url: #media-features
text: mf-name; url: #typedef-mf-name

(FWIW, the spec also exports "media type", but it's been introduced before this PR)

Comment thread index.bs
<div algorithm="evaluate media feature">
To get the result of evaluating a [=media feature=] |media feature| in the given [=/Document=] |document|:

1. Let |media feature name| be the |media feature|'s [=mf-name=].
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
1. Let |media feature name| be the |media feature|'s [=mf-name=].
1. Let |media feature name| be the |media feature|'s <<mf-name>>.

Note: this will render as <mf-name>, but that matches how the CSS spec defines it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants