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

[css-highlight-api] Need clarification on expected default values for style properties #6375

Closed
ffiori opened this issue Jun 10, 2021 · 3 comments · Fixed by #6534
Closed

Comments

@ffiori
Copy link
Contributor

ffiori commented Jun 10, 2021

I didn't find any statement on default values for style properties of ::highlight in the spec draft. There are some default values in the spec for pseudos but ::highlight is not in the list. Also in the spec draft of ::highlight there's no mention of it.

Should it use no visual effects or should it use for example Highlight/HighlightText colors instead? I assume it's taking no visual effects as default values (as in when background-color is not specified inside a ::highlight(foo) then the content's background is the same as if there was no ::highlight defined), but maybe it should be explicitly stated?

@sanketj
Copy link
Member

sanketj commented Jun 11, 2021

Since ::highlight targets author-defined highlights rather than UA-defined highlights, I don't think UAs should define any styles for ::highlight in their default stylesheets. It's also actually not possible to do this since ::highlight requires a highlight name to be passed and there's no way to write a rule that targets all ::highlight pseudos.

The default styles should just be inherited from the originating element. I do agree that we should mention this explicitly in the spec though.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed highlights and default values for styles, and agreed to the following:

  • RESOLVED: UA does not add any default styles to custom highlights
The full IRC log of that discussion <fantasai> Topic: highlights and default values for styles
<Rossen_> ack emilio
<fantasai> github: https://github.com//issues/6417
<fantasai> github: https://github.com//issues/6375
<fantasai> dandclark: CSS Pseudo specifies default values for certain native highlights. Should there be any defaults for custom highlights?
<fantasai> dandclark: Since these are author-defined highlight, don't think should define any styles in UA styles
<fantasai> dandclark: also no way to do this
<fantasai> dandclark: Seems better to let it just inherit from originating element
<fantasai> dandclark: Might want to make explicit that UA should not give default styles
<sanketj> s/dandclark/sanketj
<TabAtkins> fantasai: I agree with this
<fantasai> s/dandclark/sanketj
<fantasai> s/dandclark/sanketj
<fantasai> s/dandclark/sanketj
<fantasai> fantasai: Doesn't make any sense for UA to add default styles to custom highlights
<fantasai> Rossen_: Any objections?
<fantasai> RESOLVED: UA does not add any default styles to custom highlights

@sanketj
Copy link
Member

sanketj commented Aug 17, 2021

This issue requires an update to the spec, which is still pending. Leaving this open till that has landed.

@sanketj sanketj reopened this Aug 17, 2021
sanketj pushed a commit that referenced this issue Aug 23, 2021
…#6375 (#6534)

* Specify that custom highlights have no UA styles, and inherit the styles of the originating element

* Lowercase 'c' in custom highlight pseudo-elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants