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

Fix user-agent style rules for top layer transitions #9387

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

Conversation

josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Jun 5, 2023

With the new css-position spec and overlay CSS property, it is possible for popovers, dialogs, and their ::backdrops to be in the top layer while transitioning from showing to hidden. During this time, :popover-open and :modal don't apply, but we still want the user-agent styles to apply as if these elements were still showing in the top layer. This PR accomplishes this by moving these styles from selectors with :modal or :popover-open to a definition which says that the element is in the top layer. This is implemented in chromium with an internal pseudo-selector.

These rules can't be accomplished with existing selectors and pseudo-selectors because there is no way to select an element which is transitioning to closed but is still being rendered in the top layer.

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/rendering.html ( diff )

With the new css-position spec and overlay CSS property, it is possible
for ::backdrop and its corresponding element with the popover attribute
to be in the top layer while it is transitioning from showing to hidden.
During this time, :popover-open does not apply but the element and
::backdrop are still in the top layer, but we still want our
popover-specific user-agent style rules for ::backdrop to apply. This PR
accomplishes this by moving the ::backdrop style rule from a stylesheet
to a more specific definition.

This was implemented in chromium by replacing the
:popover-open::backdrop selector with an internal pseudo-selector.
@josepharhar josepharhar added the topic: popover The popover attribute and friends label Jun 5, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 5, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 6, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
@annevk annevk requested a review from nt1m June 6, 2023 10:58
@nt1m
Copy link
Member

nt1m commented Jun 7, 2023

@josepharhar Can you solve the issue by just re-writing the UA styles to be this?

/* common to fullscreen, dialog, popover */
::backdrop {
    display: block;
    position: fixed;
    inset: 0;
}

/* fullscreen */
:not(:root):fullscreen::backdrop {
    background: black;
}

/* modal dialogs */
dialog:not([popover])::backdrop,
dialog[popover]:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

/* popovers that aren't fullscreen or modal dialogs */
[popover]:not(:modal)::backdrop {
    pointer-events: none;
}

@nt1m
Copy link
Member

nt1m commented Jun 7, 2023

I'm defining the modal pseudo class here: #9395

@nt1m
Copy link
Member

nt1m commented Jun 7, 2023

cc @mfreed7 @lilles

@mfreed7
Copy link
Contributor

mfreed7 commented Jun 7, 2023

@josepharhar Can you solve the issue by just re-writing the UA styles to be this?

/* common to fullscreen, dialog, popover */
::backdrop {
    display: block;
    position: fixed;
    inset: 0;
}

/* fullscreen */
:not(:root):fullscreen::backdrop {
    background: black;
}

/* modal dialogs */
dialog:not([popover])::backdrop,
dialog[popover]:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

/* popovers that aren't fullscreen or modal dialogs */
[popover]:not(:modal)::backdrop {
    pointer-events: none;
}

I think that works. Curious though, can't the dialog rules just be this:

dialog:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

It can only be :modal, even if it matches [popover], if it got there via showModal(). Right?

@nt1m
Copy link
Member

nt1m commented Jun 7, 2023

I think that works. Curious though, can't the dialog rules just be this:

dialog:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

It can only be :modal, even if it matches [popover], if it got there via showModal(). Right?

I mostly wrote it that way in case you want the rule to match during a transition, but yeah dialog:modal::backdrop works too if that doesn't matter too much.

@lilles
Copy link
Contributor

lilles commented Jun 7, 2023

Quickly looking at the implementation in Chrome, :modal does not match after close() going through the transition.

@nt1m
Copy link
Member

nt1m commented Jun 7, 2023

Quickly looking at the implementation in Chrome, :modal does not match after close() going through the transition.

dialog:not([popover])::backdrop,
dialog[popover]:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

would cover this case.

@mfreed7
Copy link
Contributor

mfreed7 commented Jun 7, 2023

dialog:not([popover])::backdrop,

Oh, clever, that's why you wrote it that way. I think there's still a problem though: what if you have <dialog popover> and you do dialog.showModal(). And you transition the closing of the dialog. Then during dialog.close(), neither of those selectors will match. (The top one won't because it does have [popover] but it just isn't being used at the moment.)

I think you do actually need a pseudo state for "is a popover in the top layer", which is what this PR tries to do.

@nt1m
Copy link
Member

nt1m commented Jun 8, 2023

Oh, clever, that's why you wrote it that way. I think there's still a problem though: what if you have and you do dialog.showModal(). And you transition the closing of the dialog. Then during dialog.close(), neither of those selectors will match. (The top one won't because it does have [popover] but it just isn't being used at the moment.)

Calling showModal() on a <dialog popover> is a pattern I'd be ok not supporting tbh. It already leads to weird behavior when you try to light dismiss the popover modal dialog since the page would remain inert.

@nt1m
Copy link
Member

nt1m commented Jun 8, 2023

In any case, I think it would be worth looking into cleaning up the UA styles a bit.

@josepharhar
Copy link
Contributor Author

josepharhar commented Jun 13, 2023

[popover]:not(:modal)::backdrop and [popover]:popover-open::backdrop aren't working for the overlay-transition-backdrop-entry.html test I'm adding:
https://github.com/web-platform-tests/wpt/pull/40369/files#diff-9dc3657353b3d04b1a244272b418d008cc6773665b6e7ff0e096dd35543446b3

We need to stop matching the user-agent styles to ::backdrop when the popover is showing but its entrance into the top layer has been delayed with overlay. This does not have any interactions with dialog elements.

Nevermind, that test is a work in progress and was not working with the changes for this PR anyways

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 13, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
@mfreed7
Copy link
Contributor

mfreed7 commented Jun 15, 2023

Calling showModal() on a <dialog popover> is a pattern I'd be ok not supporting tbh. It already leads to weird behavior when you try to light dismiss the popover modal dialog since the page would remain inert.

I'd be supportive of that also, but it unfortunately doesn't solve the problem. You could do showModal() and then add [popover] after that. And in that case the UA style rules are still broken. So I don't think we should prohibit this case, since it doesn't solve anything.

We used to have a "transitioning" state explicitly in the spec, but it was unfortunately removed due to pushback. But what we really have here is a state that represents "transitioning". The UA style rules need to apply during transitions. To do that, without exposing the "transitioning" state to JS, we need an internal pseudo class and the equivalent in spec text (i.e., this PR).

aarongable pushed a commit to chromium/chromium that referenced this pull request Jun 16, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4585724
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158640}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 16, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4585724
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158640}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 16, 2023
This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4585724
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158640}
@nt1m
Copy link
Member

nt1m commented Jun 17, 2023

/* common to fullscreen, dialog, popover */
::backdrop {
    display: block;
    position: fixed;
    inset: 0;
}

:not(:root):fullscreen::backdrop {
    background: black;
}

dialog:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

[popover]:popover-open::backdrop {
    pointer-events: none;
}

@mfreed7 @josepharhar Here's another idea, it sounded like the Chromium bug report was about the popover & dialog ::backdrop styles not having the same lifespan wrt transitions.

The styles above would make it as short for both dialog & popover ^

If the author wants to preserve the ::backdrop styles during the transition, they can add a transition to the backdrop or unconditionally add the background there.

@josepharhar
Copy link
Contributor Author

josepharhar commented Jun 20, 2023

Quickly looking at the implementation in Chrome, :modal does not match after close() going through the transition.

dialog:not([popover])::backdrop,
dialog[popover]:modal::backdrop {
    background: rgba(0, 0, 0, 0.1);
}

would cover this case.

This could fix the backdrop, but the user-agent styles for the dialog element itself which keep it in the center of the screen also need to stay applied while animating out, during which time the dialog does not match :modal: https://bugs.chromium.org/p/chromium/issues/detail?id=1451910

I suppose that in order to fix this, we could move the positioning related styles from the dialog:modal selector to the dialog selector, which would also make it match while the dialog is closed... or add an internal pseudo selector which matches when an element is in the top layer and use that instead.

Edit: Moving the whole thing from dialog:modal to dialog won't work since then it would also match non-modal dialogs

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 22, 2023
…animating out, a=testonly

Automatic update from web-platform-tests
Make ::backdrop stay in top layer while animating out

This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4585724
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158640}

--

wpt-commits: 83976e7d1f6a7b175947209736bd40e94a7cae77
wpt-pr: 40369
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jun 22, 2023
…animating out, a=testonly

Automatic update from web-platform-tests
Make ::backdrop stay in top layer while animating out

This patch adds a new internal pseudo class which matches popovers while
they are still in the top layer after they have been closed in order to
also make the corresponding ::backdrop stay in the top layer.

This is based on futhark's patch:
https://chromium-review.googlesource.com/c/chromium/src/+/4554016

HTML spec PR: whatwg/html#9387

Fixed: 1449145
Change-Id: I8e4831e960c5d18fb077f023c119fd0e678541df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4585724
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158640}

--

wpt-commits: 83976e7d1f6a7b175947209736bd40e94a7cae77
wpt-pr: 40369
@josepharhar
Copy link
Contributor Author

I pushed some commits for similar fixes for the dialog element, which I learned about and am fixing here: https://bugs.chromium.org/p/chromium/issues/detail?id=1451910

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 3, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 3, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 4, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
aarongable pushed a commit to chromium/chromium that referenced this pull request Aug 4, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 4, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 4, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}
@josepharhar
Copy link
Contributor Author

@nt1m What do you think of the current state of this PR? I'd like to get multi-implementer interest

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Aug 18, 2023
…e in top layer, a=testonly

Automatic update from web-platform-tests
Make dialog user-agent styles apply while in top layer

This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}

--

wpt-commits: d315170388cc39a79899491733317a74d02e19f1
wpt-pr: 41330
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Aug 18, 2023
…e in top layer, a=testonly

Automatic update from web-platform-tests
Make dialog user-agent styles apply while in top layer

This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}

--

wpt-commits: d315170388cc39a79899491733317a74d02e19f1
wpt-pr: 41330
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

In addition to @nt1m it would be good to see review from @tabatkins too.

<li><span>'pointer-events'</span> property to 'none !important'</li>
<li><span>'background-color'</span> property to 'transparent'</li>
</ul>

Copy link
Member

Choose a reason for hiding this comment

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

Nit: you are eating a newline here.

@tabatkins
Copy link
Contributor

Sorry for coming in late, but if the existing pseudoclasses aren't sufficient for UA usage, does that indicate they'll similarly be insufficient for author usage? I'm not sure I see why an author would be okay with their :modal styles no longer applying while the element is still acting modal-ish. Am I missing something that makes these phases okay to only be targetable by the UA itself?

If not, the correct path would be to fix the definitions of the pseudoclasses, to match what they actually need to.

@josepharhar
Copy link
Contributor Author

Yeah, we could make the internal pseudoclass a real pseudoclass for authors too. It just didn't seem like an important use case to provide for authors

@fantasai
Copy link
Contributor

The UA style rules need to apply during transitions.

A different way to make that happen is to call out the relevant properties in transition-property, and give them a step-end easing function--basically handling them the same way that was proposed for the overlay property itself.

The main awkwardness with this that authors need to remember what properties are involved--but we could solve that by providing a keyword that functions just like a shorthand, expanding out to the relevant set of properties. For example, something like ua-modal-dialog would expand out to overlay, overflow, inset, etc.

The author can then easily control these properties together as one unit; or split out individual ones by listing them individually later in the list, just like for regular shorthands (e.g. transition: border ease, border-style step-start).

(We could maybe even go a step further and add a generic keyword that computes to the correct set of properties depending on the element involved.)

Note: Another solution would be to invent additive cascade and have the UA default stylesheet include these properties together with a step-end easing function, so that authors can just add to the list; but that's a much larger project than I suspect we want to tackle here. :)

@josepharhar
Copy link
Contributor Author

josepharhar commented Sep 4, 2023

I see how are are kind of requiring authors to transition overlay, but I'd rather not add even more stuff for authors to include to make the exit animation reasonable.

If we end up deprecating and removing non-modal dialog.show(), then we could make these user-agent styles also apply when the dialog is in any state and then none of this stuff would be needed anymore. I'm not sure if this would also work with popover but it might - I'm going to go test it out.
EDIT: I tested it out and I think its fine except that <dialog popover>s can't differentiate between whether they should have popover styles or dialog styles during the transition out since :modal and :popover-open are both gone. Maybe this is fine though? Or we could have an internal selector to make this differentiation.

@annevk
Copy link
Member

annevk commented Sep 6, 2023

I think for web developers it would not be that much more work. Instead of overlay you'd either use overlay-dialog or overlay-popover and those would expand to the relevant properties. The upside of that is that we don't end up with magical unexplained states only the user agent gets to style.

Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this pull request Dec 11, 2023
This makes it so that while the dialog element is doing an exit
animation, its positioning etc. styles from the user-agent stylesheet
still apply so it doesnt jump to a different spot while animating out.
The :modal class is removed during this time which is why it was a
problem before. We also can't just make all dialog elements always have
these styles applied, because then they would also apply to non-modal
dialogs.

Spec: whatwg/html#9387

Fixed: 1451910
Change-Id: I4d2b240ab17879d6cf08f94f32d7c7577e9f53ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4739784
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179848}
@domenic
Copy link
Member

domenic commented Jan 25, 2024

What is the current status on this? I haven't read all of the above, but just trying to ask some general questions to get things moving:

@josepharhar, do you believe the current PR draft represents the best proposal at this point, in light of the above discussions? If so, @annevk @tabatkins @nt1m what do you think of it?

@josepharhar
Copy link
Contributor Author

Sorry for coming in late, but if the existing pseudoclasses aren't sufficient for UA usage, does that indicate they'll similarly be insufficient for author usage? I'm not sure I see why an author would be okay with their :modal styles no longer applying while the element is still acting modal-ish. Am I missing something that makes these phases okay to only be targetable by the UA itself?

If not, the correct path would be to fix the definitions of the pseudoclasses, to match what they actually need to.

Yeah I suppose that we could try making :modal match while the dialog is in the top layer rather than matching while its modal flag is true. I haven't worked on this in some time but I imagine that could be all we need. Does that sound ok to everyone?

@mfreed7
Copy link
Contributor

mfreed7 commented Jan 27, 2024

Yeah I suppose that we could try making :modal match while the dialog is in the top layer rather than matching while its modal flag is true. I haven't worked on this in some time but I imagine that could be all we need. Does that sound ok to everyone?

I don't have strong opinions, but one thing to note: the "modal" nature of the dialog goes away immediately. The only thing that is preserved during an animation is the top layer status. In that sense, :modal not matching immediately sounds technically correct.

@annevk
Copy link
Member

annevk commented Feb 5, 2024

How does that allow you to style the transition? I'm not seeing it. I still think we need something akin to what @fantasai wrote above and ideally the CSS WG does a thorough review of it first.

@josepharhar
Copy link
Contributor Author

I created a csswg issue to discuss: w3c/csswg-drafts#9912

@nt1m
Copy link
Member

nt1m commented Feb 5, 2024

@josepharhar @mfreed7 I actually wonder if the UA styles could be transition-property: overlay, overflow, inset, etc. by default, but with the transition-duration set to 0. On the author level, they would just need to override duration if they want.

We could also have an additive CSS solution transition-property: revert-layer, additional-properties-to-transition

@josepharhar
Copy link
Contributor Author

I actually wonder if the UA styles could be transition-property: overlay, overflow, inset, etc. by default, but with the transition-duration set to 0. On the author level, they would just need to override duration if they want.

If the author uses transition or transition-property it would override these, right? So If I wanted to transition opacity for 1 second, then all of these UA styles wouldn't apply anymore and I'd have to also add overflow inset etc. again right?

@nt1m
Copy link
Member

nt1m commented Feb 5, 2024

I actually wonder if the UA styles could be transition-property: overlay, overflow, inset, etc. by default, but with the transition-duration set to 0. On the author level, they would just need to override duration if they want.

If the author uses transition or transition-property it would override these, right? So If I wanted to transition opacity for 1 second, then all of these UA styles wouldn't apply anymore and I'd have to also add overflow inset etc. again right?

Yeah hence the suggestion for additive CSS: transition: revert-layer 0.3s, translate 0.2s, which would also apply the properties from the UA sheet.

@nt1m
Copy link
Member

nt1m commented Feb 5, 2024

The revert-layer bit would need to be a CSSWG addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: popover The popover attribute and friends topic: rendering
Development

Successfully merging this pull request may close these issues.

8 participants