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 opacity property improvements #31190

Closed
estelle opened this issue Dec 21, 2023 · 1 comment · Fixed by #31725
Closed

CSS opacity property improvements #31190

estelle opened this issue Dec 21, 2023 · 1 comment · Fixed by #31725
Labels
Content:CSS Cascading Style Sheets docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@estelle
Copy link
Member

estelle commented Dec 21, 2023

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/opacity

What specific section or headline is this issue about?

feedback from #30999

What information was incorrect, unhelpful, or incomplete?

Stuff i would love to see:

  • Even though opacity: 0 elements are not visible, they are still part of the DOM. If they are in the tabbing order when invisible, they get focus. We do mention pointer events. But we should tell people to make the content visible when focused.

  • Opacity alone should not be used to provide information to screen readers. Use the hidden attribute or visibility or display style properties. It's best to avoid using aria-hidden attribute, but if hidden with opacity, hide it from screen readers too.

  • a mention of setting opacity as a value for @starting-style when transitioning from display none to a visible value.

  • a comment in the stacking context paragraph about how adding opacity can improve perf, with a link to where that's described.

  • maybe a link to a drag/drop example as opacity is commonly used on items being dragged.

What did you expect to see?

the above

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Dec 21, 2023
@estelle estelle changed the title Opacity property improvements CSS opacity property improvements Dec 24, 2023
@OnkarRuikar
Copy link
Contributor

a comment in the stacking context paragraph about how adding opacity can improve perf, with a link to where that's described.

Though it creates a new stacking context the opacity: .9999 is an expensive property. I think it's better to use z-index or zero transform.

maybe a link to a drag/drop example as opacity is commonly used on items being dragged.

As per the latest drag and drop HTML API browsers automatically create semitransparent ghost of the dragged element. In dev tools simply add draggable="true" to any HTML element and try dragging it. We don't have to explicitly set opacity anymore. Also, none of MDN live drag and drop demo uses opacity property.

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 needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants