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

Standardize UA styles / presentational hints for embed hidden #9564

Closed
nt1m opened this issue Jul 28, 2023 · 9 comments · Fixed by #9664
Closed

Standardize UA styles / presentational hints for embed hidden #9564

nt1m opened this issue Jul 28, 2023 · 9 comments · Fixed by #9664

Comments

@nt1m
Copy link
Member

nt1m commented Jul 28, 2023

We noticed this WPT: https://wpt.fyi/results/html/semantics/embedded-content/the-embed-element/embed-hidden-attribute.html?label=master&label=experimental&aligned

(which looks perfectly reasonable), does not have a spec counterpart to it.

CC @mfreed7 who created the test.

@nt1m
Copy link
Member Author

nt1m commented Jul 28, 2023

cc @whatwg/css

@mfreed7
Copy link
Collaborator

mfreed7 commented Jul 28, 2023

Thanks for raising this! It came out of this Chromium bug, which has more discussion, particularly about cross-browser behavior.

Can you comment on why the hidden attribute (which is global) doesn't just automatically apply to <embed> elements? It says

When an element has the hidden attribute in the hidden state, it indicates that the element is not yet, or is no longer, directly relevant to the page's current state, or that it is being used to declare content to be reused by other parts of the page as opposed to being directly accessed by the user. User agents should not render elements that are in the hidden state. This requirement may be implemented indirectly through the style layer. For example, a web browser could implement these requirements using the rules suggested in the Rendering section.

I was just going on that when I wrote the test.

@nt1m
Copy link
Member Author

nt1m commented Jul 28, 2023

I agree about the hidden attribute applying, I was more referring to the width: 0; height: 0; part of how browser engines are implementing hiding.

@mfreed7
Copy link
Collaborator

mfreed7 commented Aug 3, 2023

I agree about the hidden attribute applying, I was more referring to the width: 0; height: 0; part of how browser engines are implementing hiding.

Ahh, I see. You want to spec more of the detail of how "should not render" is achieved?

@nt1m
Copy link
Member Author

nt1m commented Aug 4, 2023

Yeah, I received a PR for a change regarding that in WebKit, and it was unclear to me what was the right way to stop rendering.

@zcorpan
Copy link
Member

zcorpan commented Aug 14, 2023

https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements says

embed[hidden] { display: inline; height: 0; width: 0; } 

(display: inline overrides the [hidden]:not([hidden=until-found i]) { display: none; } rule)

Does that not cover what the test expects?

@annevk
Copy link
Member

annevk commented Aug 18, 2023

I think it does. @nt1m please reopen if you disagree.

@annevk annevk closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2023
@zcorpan
Copy link
Member

zcorpan commented Aug 31, 2023

Hold on. Specificity wars are at play here, right?

embed[hidden] has specificity 0.1.1.

[hidden]:not([hidden=until-found i]) has specificity 0.2.0, so it wins.

We need [hidden]:where(:not([hidden=until-found i])) to make it 0.1.0 so the display: inline will apply.

@zcorpan zcorpan reopened this Aug 31, 2023
@zcorpan
Copy link
Member

zcorpan commented Aug 31, 2023

alternatively [hidden]:not([hidden=until-found i]):not(embed)

zcorpan added a commit that referenced this issue Aug 31, 2023
The embed[hidden] rule was intended to override 'display' but had lower specificity.

Fixes #9564.
zcorpan added a commit that referenced this issue Sep 4, 2023
The embed[hidden] rule was intended to override 'display' but had lower specificity.

Fixes #9564.
rubberyuzu pushed a commit to rubberyuzu/html that referenced this issue Sep 5, 2023
The embed[hidden] rule was intended to override 'display' but had lower specificity.

Fixes whatwg#9564.

mc

mc

Add iframe code

mc

Dmc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants