IRenderDevice models the Media Queries Level 3/4 device features (viewport and device size, resolution, colour depth, grid, scan, scripting, category) but none of the Media Queries Level 5 user-preference features:
prefers-color-scheme: light | dark
prefers-reduced-motion: no-preference | reduce
prefers-reduced-transparency: no-preference | reduce
prefers-contrast: no-preference | more | less | custom
forced-colors: none | active
prefers-reduced-data: no-preference | reduce
From Level 4, hover / any-hover and pointer / any-pointer have validators but no device member to read from, and display-mode (Web App Manifest) has none.
Each of these is an unknown feature today and answers false, so @media (prefers-color-scheme: dark), by some distance the most common Level 5 query on the web, never applies in the cascade, and matchMedia("(prefers-color-scheme: dark)").matches (with #228) is always false. Neither is wrong for a device that has no preference, but a host that has one, such as a headless browser emulating a dark theme or reduced motion for a page, has no way to say so.
Suggested shape: one enum per feature, the properties on DefaultRenderDevice plus a new sub-interface (say IRenderDevicePreferences) that existing IRenderDevice implementers are not forced to implement, defaulting to "no preference" when the device does not carry it; one validator per feature registered in DefaultFeatureValidatorFactory; keywords in CssKeywords, names in FeatureNames. Happy to send a PR if the shape is agreed; the interface extension is the part that needs your call first.
Independent of the four evaluation defects filed alongside.
IRenderDevicemodels the Media Queries Level 3/4 device features (viewport and device size, resolution, colour depth,grid,scan,scripting, category) but none of the Media Queries Level 5 user-preference features:prefers-color-scheme: light | darkprefers-reduced-motion: no-preference | reduceprefers-reduced-transparency: no-preference | reduceprefers-contrast: no-preference | more | less | customforced-colors: none | activeprefers-reduced-data: no-preference | reduceFrom Level 4,
hover/any-hoverandpointer/any-pointerhave validators but no device member to read from, anddisplay-mode(Web App Manifest) has none.Each of these is an unknown feature today and answers false, so
@media (prefers-color-scheme: dark), by some distance the most common Level 5 query on the web, never applies in the cascade, andmatchMedia("(prefers-color-scheme: dark)").matches(with #228) is always false. Neither is wrong for a device that has no preference, but a host that has one, such as a headless browser emulating a dark theme or reduced motion for a page, has no way to say so.Suggested shape: one enum per feature, the properties on
DefaultRenderDeviceplus a new sub-interface (sayIRenderDevicePreferences) that existingIRenderDeviceimplementers are not forced to implement, defaulting to "no preference" when the device does not carry it; one validator per feature registered inDefaultFeatureValidatorFactory; keywords inCssKeywords, names inFeatureNames. Happy to send a PR if the shape is agreed; the interface extension is the part that needs your call first.Independent of the four evaluation defects filed alongside.