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

Update index.md - Added note due to accessibility issues with high contrast mode. #36206

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

Conversation

MarcusMorba
Copy link

@MarcusMorba MarcusMorba commented Oct 5, 2024

Description

Note

Generating visual content like in the above mentioned example may not display the expected results, when high contrast mode is applied.>

Motivation

Support for high contrast mode is an important feature for accessibility.

Affected page: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements
Relevant section: "Generating content with ::before and ::after"
Relevant Paragraph: "A great example is the site CSS Arrow Please, which helps you to generate an arrow with CSS. Look at the CSS as you create your arrow and you will see the ::before and ::after pseudo-elements in use. Whenever you see these selectors, look at the content property to see what is being added to the HTML element."

Added note due to accessibility issues with high contrast mode.

> [!NOTE]
> Generating visual content like in the above mentioned example may not display the expected results, when high contrast mode is applied.
@MarcusMorba MarcusMorba requested a review from a team as a code owner October 5, 2024 13:28
@MarcusMorba MarcusMorba requested review from chrisdavidmills and removed request for a team October 5, 2024 13:28
@github-actions github-actions bot added Content:Learn:CSS Learning area CSS docs size/xs [PR only] 0-5 LoC changed labels Oct 5, 2024
Copy link
Contributor

github-actions bot commented Oct 6, 2024

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.

Hi @MarcusMorba, and thank you for your interest in contributing to MDN. I have some comments and questions, and suggestions for making the content more useful. I know this is a bit more work than you were originally intending. Let me know your thoughts.

@@ -120,6 +120,9 @@ In this next example, we have added an empty string using the `::before` pseudo-

The use of the `::before` and `::after` pseudo-elements along with the `content` property is referred to as "Generated Content" in CSS, and you will often see this technique being used for various tasks. A great example is the site [CSS Arrow Please](https://cssarrowplease.com/), which helps you to generate an arrow with CSS. Look at the CSS as you create your arrow and you will see the {{cssxref("::before")}} and {{cssxref("::after")}} pseudo-elements in use. Whenever you see these selectors, look at the {{cssxref("content")}} property to see what is being added to the HTML element.

> [!NOTE]
> Generating visual content like in the above mentioned example may not display the expected results, when high contrast mode is applied.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
> Generating visual content like in the above mentioned example may not display the expected results, when high contrast mode is applied.
> Generating visual content like in the above mentioned example may not display the expected results, when high contrast mode is applied.

I have a couple of thoughts here:

  1. I agree that supporting high contrast mode is an important consideration for a11y, but isn't it important for all visual aspects of a website? Why single out generated content in particular?
  2. This content is supposed to be a beginner's guide to using pseudo-classes/elements. Your note in its current state probably confuses more than it helps — they might ask "what is high contrast mode?", and "how do I get my content to display as expected results in high contract mode?"

Ideally it would be good to:

  1. Create some content that explains what high contrast mode is, and how to design for it.
  2. Link to it from suitable places where you want to point out that high contrast mode is an important consideration.

If anything, https://developer.mozilla.org/en-US/docs/Learn/CSS/Howto/Generated_content is probably a better place to talk about the importance of high contrast modes and generated content.

We have a guide to color contrast at https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast. Maybe that would be a place to talk about handling high contrast?

Copy link
Author

Choose a reason for hiding this comment

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

Hi Chris,
thanks for your comments. Please be patient for a while, until I have checked the other sections and can provide something better.

Regarding the comment, that this is a beginner guide - especially beginners should made aware that solutions might not work for all and that accessibility is more important than ever. If not learned about accessibility right from the beginning, it´s often hard to change already learned methods.

Otherwise, we would not have so many basic accessibility issues everywhere.

Copy link
Author

@MarcusMorba MarcusMorba Oct 8, 2024

Choose a reason for hiding this comment

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

Maybe an option is to improve the linked example?
Will check this out: https://github.com/hojberg/cssarrowplease

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, thanks for your consideration @MarcusMorba.

I agree that the linked example could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Learn:CSS Learning area CSS docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants