csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-anchor-position-1] Define `CSSPositionTryRule.style` as `CSSPositionTryProperties`

Open cdoublev opened this issue 11 months ago • 2 comments

It is currently defined as a CSSStyleDeclaration, which seems to cause problems.

Now that CSS*Properties and CSS*Descriptors interfaces inheriting CSSStyleDeclaration have landed in CSSOM and other specs, maybe valid properties could be defined in CSSPositionTryRuleDescriptors, either explicitly or with some prose (see #10105)?

cdoublev avatar Mar 21 '24 09:03 cdoublev

Declarations in @position-try are not descriptors but properties, so maybe CSSPositionTryProperties is better?

xiaochengh avatar Mar 21 '24 09:03 xiaochengh

Ah correct, they apply to an element. Corrected in the title.

cdoublev avatar Mar 21 '24 10:03 cdoublev

Agenda+ to check if we do indeed want to specify all future types of these rules in this style.

tabatkins avatar Apr 08 '24 22:04 tabatkins

The CSS Working Group just discussed [css-anchor-position-1] Define `CSSPositionTryRule.style` as `CSSPositionTryProperties` , and agreed to the following:

  • RESOLVED define a new interface type for position-try similar to how page descriptors are defined, with every allowed property included
The full IRC log of that discussion <chrishtr> TabAtkins: the CSSOM interface for position-try has a CSSStyleDeclaration object to hold the properties at present.
<emilio> q+
<chrishtr> TabAtkins: however, some similar @ rules like page rules, have been done by exposing the properties valid on it directly
<chrishtr> TabAtkins: do we want to follow that same pattern?
<chrishtr> TabAtkins: currrently only spec prose prevents exposing all CSS properties since the type allows it
<chrishtr> TabAtkins: but page rules only accepts the properties specified by what that spec accepts
<chrishtr> TabAtkins: should we go with the page rules approach and settle that as as a precedent as well for future patterns?
<TabAtkins> https://drafts.csswg.org/cssom/#the-csspagerule-interface
<chrishtr> TabAtkins the page rules object has a CSSPageDescriptors interface that explicitly lists the allowed properties
<chrishtr> emilio: page is different because there are some properties that don't exist in CSSStyleDeclaration
<chrishtr> emilio: a better comparison to try rules is keyframe rules, which disallow some properties
<chrishtr> TabAtkins: yes that's similar but since they exclude some of the properties and copying that mechanism could be annoying (?)
<chrishtr> emilio: prefer to be consistent with keyframe rules for consistency
<Rossen__> ack emilio
<chrishtr> emilio: if we did that then also future extensions to position-try would be more easily feature detectible
<chrishtr> dbaron: another thing to keep in mind is whether properties that do not apply in position try should be parsed and stored in the CSSOM object.
<chrishtr> dbaron: not sure whether this happens for animation properties in keyframes
<chrishtr> fantasai: seems unlike that developers will rely on whether these properties are stored on keyframes, so we could likely change that
<chrishtr> fantasai: think position try should be more like keyframes, because both apply to regular elements. but page descriptors are a special context that is not quite like visual display on the screen.
<chrishtr> emilio: don't want another interface with hundreds of properties on it just to prevent animation properties in keyframes, that seems not useful
<chrishtr> emilio: this would be a waste because there would be some basically useless generated code and spec to maintain
<fantasai> that's a fair point, dbaron
<chrishtr> dbaron: the part that is more like page descriptors than keyframes is that position-try has a short list of properties allowed whereas keyframes has a very long list
<chrishtr> emilio: that would be fine
<fantasai> s/visual display on the screen/regular box layout/
<chrishtr> TabAtkins: it seems people think that aligning with page descriptors makes more sense because it's a small subset of properties
<chrishtr> proposed resolution: define a new interface type for position-try similar to how page descriptors are defined, with every allowed property included
<chrishtr> RESOLVED define a new interface type for position-try similar to how page descriptors are defined, with every allowed property included
<Rossen__> s/RESOLVED/RESOLVED:/

css-meeting-bot avatar Apr 10 '24 16:04 css-meeting-bot

I assume the name choice of CSSPositionTryDescriptors rather than CSSPositionTryProperties was intentional, despite https://github.com/w3c/csswg-drafts/issues/10108#issuecomment-2011787778.

cdoublev avatar Apr 11 '24 04:04 cdoublev

Yes, I'm leaving open the possibility that we could add non-property descriptors to the at-rule in the future. I'd also weakly prefer the naming schemes for all these similar interfaces be as similar as possible.

tabatkins avatar Apr 15 '24 21:04 tabatkins