Skip to content

Add new information about recent CSS inheritance changes with CSS selection and highlight pseudo-classes #38989

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dbarabashh
Copy link
Contributor

@dbarabashh dbarabashh commented Apr 5, 2025

Fix #36458

@dbarabashh dbarabashh requested a review from a team as a code owner April 5, 2025 14:08
@dbarabashh dbarabashh requested review from chrisdavidmills and removed request for a team April 5, 2025 14:08
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed labels Apr 5, 2025
Copy link
Contributor

github-actions bot commented Apr 5, 2025

Preview URLs

Flaws (2)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/CSS/CSS_pseudo-elements
Title: CSS pseudo-elements
Flaw count: 2

  • macros:
    • Macro produces link /en-US/docs/Web/HTML/Element/input which is a redirect
    • Macro produces link /en-US/docs/Web/HTML/Element/div which is a redirect
External URLs (1)

URL: /en-US/docs/Web/CSS/CSS_pseudo-elements
Title: CSS pseudo-elements

(comment last updated: 2025-04-14 14:16:49)

@Josh-Cena Josh-Cena requested a review from captainbrosset April 5, 2025 15:38
Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

@dbarabashh thanks for the contribution! I've added some thoughts on how I think this could be handled.

@dbarabashh
Copy link
Contributor Author

I made some changes and updated the text, but I have a feeling its a bit hard to understand. Considering less experienced developers, this explanation might be too complex. What do you think?

/cc @chrisdavidmills

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

@dbarabashh It's getting there. A couple more comments for you.

I also wondered if you could link to this section from all the pseudo-element reference pages that follow this inheritance model?

@github-actions github-actions bot added size/m [PR only] 51-500 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Apr 12, 2025
Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

@dbarabashh thanks for your further work on this. The content is all there now, I think, I just had some suggestions on wording and ordering for you to look through. The bigger issue really is that the main explainer content is on the wrong page. I've included comments to help you put it on the right page, in the right place.

Thanks again.

@@ -13,6 +13,100 @@ Pseudo-elements are prefixed with a double colon (`::`). You add pseudo-elements

Pseudo-elements enable targeting entities not included in HTML and sections of content that cannot be targeted otherwise without adding extra markup. Consider the placeholder of an {{HTMLelement("input")}} element. This is an abstract element and not a distinct node in the document tree. You can select this placeholder by using the {{CSSXref("::placeholder")}} pseudo-element. As another example, the {{CSSXref("::selection")}} pseudo-element matches the content currently highlighted by a user, allowing you to style what is matched as the user interacts with the content and changes the selection. Similarly, the {{CSSXref("::first-line")}} pseudo-element targets the first line of an element, updating automatically if the character count of the first line changes, without having to query the element's line length.

## Description
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, the biggest issue here is something I've only just noticed (sorry about that) — this content is on the wrong pseudo-elements page. This page is about the pseudo-elements module, and module pages just list information about is contained in that module. They don't include details like this. So, the first thing you should do is move this content to https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements — this is the main pseudo-elements landing page (but pseudo-elements, the concept, not pseudo-elements, the module).

Second thing — get rid of the "Description" heading, and promote "Highlight pseudo-elements inheritance" to an H2 (and promote the subheadings up a level).

I'd place the section on https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements, just above the "Specifications" section.

}
```

#### Example
Copy link
Contributor

Choose a reason for hiding this comment

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

When you move this content up, as suggested above, don't include the "Example" heading.

{{EmbedLiveSample("Example", "100%", "150")}}

> [!NOTE]
> The exact appearance of selected text may vary slightly between browsers. For detailed information about browser support and implementation details, see the [CSS Custom Highlight API](/en-US/docs/Web/API/CSS_Custom_Highlight_API) documentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't understand how this note helps us find information about support for the different highlight pseudo-elements. I mean, it lists ::highlight() information, but what about the others? I'd suggest just removing it, or saying that you should consult the reference pages for the different pseudo-classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new information about recent CSS inheritance changes with CSS selection and highlight pseudo-classes
2 participants