Skip to content

[css-pseudo] highlight pseudos and emphasis/underline properties #7101

Closed

Description

@delan

https://drafts.csswg.org/css-pseudo-4/#highlight-styling

The following properties apply to the highlight pseudo-elements:

The current spec text could be interpreted as only allowing ‘text-decoration’ and ‘text-decoration-*’ and ‘text-shadow’, which would include line decorations and text shadows, but not emphasis marks or ‘text-underline-position’ or ‘text-underline-offset’. Should we somehow allow those properties more explicitly?

(@fantasai, @frivoal, @mrego)

Activity

  1. changed the title [-][css-pseudo] highlight pseudos and emphasis marks (and underline properties)[/-] [+][css-pseudo] highlight pseudos and emphasis/underline properties[/+] on Mar 4, 2022
  2. mrego commented on Apr 1, 2022

    @mrego
    Member

    There's also text-emphasis-color (as other text-emphasis properties seem to affect the layout I guess they're not valid for highlight pseudos).

    Doing some tests, Chrome and WebKit allows you to change text-emphasis-color in ::selection, but Firefox doesn't allow it.

    However only Chrome allows to change text-decoration-color in ::selection, but Firefox and WebKit do not.

  3. delan commented on Apr 4, 2022

    @delan
    ContributorAuthor

    @mrego not sure about emphasis marks, but note that ‘text-decoration-color’ on ::selection is only for decorations added by ::selection, and originating decorations are recolored to ‘color’ (test, ref). Blink is incorrect to allow the property to change the color of originating decorations, and Firefox doesn’t yet support highlight decorations at all.

  4. added a commit that references this issue on Apr 15, 2022
    c5f37d2
  5. fantasai commented on Apr 19, 2022

    @fantasai
    Collaborator

    Clarifying that text-underline* applies is good, and adding text-emphasis-color makes sense, but I'm a little hesitant about text-emphasis itself. Unlike text decorations, emphasis dots don't overlay each other, it's just a straight-up inherited property. So there'd be some conflict between text-emphasis: none removing dots vs not doing anything. Also they can impact layout. So I don't think we can add anything other than text-emphasis-color itself here.

  6. added
    i18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.
    on Apr 19, 2022
  7. mrego commented on Apr 20, 2022

    @mrego
    Member

    Yeah I agree with @fantasai. I don't think text-emphasis in general can be applied on highlights due to the layout changes it implies, text-emphasis-color should be fine though.

  8. delan commented on Apr 20, 2022

    @delan
    ContributorAuthor

    Makes sense! I’ve updated #7222, pending discussion in the meeting.

  9. css-meeting-bot commented on May 11, 2022

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-pseudo] highlight pseudos and emphasis/underline properties, and agreed to the following:

    • RESOLVED: Accept the proposed PR
    The full IRC log of that discussion <emeyer> Topic: [css-pseudo] highlight pseudos and emphasis/underline properties
    <emeyer> Github: https://github.com//issues/7101
    <emeyer> delan: Highlight pseudos have a restricted subset of applicable properties. Not all properties in the text-decoration spec start with text-decoration-*. Question originally was, can we add those and make them applicable. I initially thought we should. fantasai and rego have mentioned most of the text-emphasis-* properties shouldn’t be applicable.
    <emeyer> …Maybe only text-emphasis-color should be applied. That’s where we are now.
    <emeyer> astearns: I’m a little worried that the proposed patch is still a little vague. Should we be very specific about what can be applied?
    <emeyer> fantasai: I don’t think we should be very specific, because as more things are added elsewhere, user agents should be free to add them here. I think the proposed wording is good enough for now.
    <tantek> +1 fantasai
    <smfr> q+
    <emeyer> delan: In general, we’re happy with all the properties related to line decorations being applicable?
    <emeyer> fantasai: Right.
    <emeyer> delan: So it’s the emphasis marks that are contentious.
    <astearns> ack smfr
    <emeyer> smfr: Are we avoiding properties that can cause ink or layout overflow?
    <emeyer> delan: Ink overflow yes, layout overflow no.
    <emeyer> fantasai: Ink overflow doesn’t trigger scrollbars. We want to avoid anything that could cause scrollbars.
    <emeyer> delan: So actually ink overflow no, layout overflow yes. Sorry, got those backwards.
    <emeyer> astearns: Ink overflow is okay, layout overflow is not okay. We could have a note in the specification saying that’s how we determine the list of properties.
    <emeyer> delan: We sort of do say that about the layout, but we could be more explicit about ink overflow.
    <iank_> changes in layout overflow implicitly effects layout.
    <emeyer> astearns: The bit we have about not affecting overflow layout is sufficient, I think.
    <emeyer> RESOLVED: Accept the proposed PR
    <fantasai> fwiw fwiw spec says “The highlight pseudo-elements can only be styled by a limited set of properties that do not affect layout and can be applied performantly in a highly dynamic environment—and additionally (to ensure interoperability) whose rendering within the required area is not dependent on the exact (UA-determined) bounds of the highlight overlay.”
  10. delan commented on Aug 18, 2022

    @delan
    ContributorAuthor

    Hmm… #highlight-text says:

    The element’s own text decorations (both line decorations and emphasis marks) are thus drawn in the pseudo-element’s own color when that is not currentColor, regardless of their original color or fill specifications.

    So if originating emphasis marks are recolored to the highlight ‘color’ just like line decorations, rather than using the highlight ‘text-emphasis-color’, and highlights can’t add their own emphasis marks with ‘text-emphasis-style’, then actually I think there’s no need for ‘text-emphasis-color’ on highlights. @fantasai, what do you think?

  11. fantasai commented on Sep 12, 2022

    @fantasai
    Collaborator

    @delan Allowing text-emphasis-color would have an effect: on existing emphasis marks in the text. Whether it's useful to allow that, I don't think it is particularly useful. :)

  12. delan commented on Sep 21, 2022

    @delan
    ContributorAuthor

    @fantasai how would it affect originating emphasis marks, given the following?

    […] Instead the topmost active highlight overlay redraws that text (and those decorations) over all the highlight overlay backgrounds using that highlight’s own color.

    Note: The element’s own text decorations (both line decorations and emphasis marks) are thus drawn in the pseudo-element’s own color when that is not currentColor, regardless of their original color or fill specifications.

    I also think originating emphasis marks get painted not because the highlight inherits ‘text-emphasis-style’, but because we say so in #highlight-painting. ‘text-emphasis-color’ has no effect when ‘text-emphasis-style’ is ‘none’, so by analogy, if we want it to have an effect when ‘text-emphasis-style’ is not applicable, we should probably say so explicitly.

  13. fantasai commented on Oct 6, 2022

    @fantasai
    Collaborator

    @delan We'd have to spec it so that the highlight's text-emphasis-color affects the highlighted emphasis marks, with currentColor referring to the highlight color.

    The question is whether this is worth doing now, or just always using currentColor and ignoring text-emphasis-color; I think it's the sort of thing we could do later if we wanted to.

  14. delan commented on Oct 6, 2022

    @delan
    ContributorAuthor

    Yeah, that makes sense. I think we should ignore ‘text-emphasis-color’ for now, or even remove it from the list until we decide to spec that behaviour. I’ve updated #7222 to remove it, but let me know if we should leave it in and somehow say it’s ignored.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed Accepted by CSSWG ResolutionChanges backed by a CSSWG resolution.css-pseudo-4Current Worki18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions