Skip to content

[css-forms-1] Should appearance: base inherit more text-related properties? #11486

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

Closed
nt1m opened this issue Jan 13, 2025 · 8 comments · Fixed by #12138
Closed

[css-forms-1] Should appearance: base inherit more text-related properties? #11486

nt1m opened this issue Jan 13, 2025 · 8 comments · Fixed by #12138

Comments

@nt1m
Copy link
Member

nt1m commented Jan 13, 2025

font is already inherited. What about other properties?

  • text-shadow
  • text-rendering
  • letter-spacing
  • word-spacing
  • text-autospace
  • text-transform
  • text-align
  • text-indent

These are currently reset on select, maybe they shouldn't be?

The reason I bring this up is because I was building a site, where I put form controls inside a table, made them transparent, and I found it desirable to inherit some of these properties from the table/body to the form controls.

cc @mfreed7 @josepharhar @emilio @fantasai

@josepharhar
Copy link
Contributor

Sounds good to me. Should they be set to inherit or something else?

There's also a few more properties from appearance:auto that are being used in chromium. Should they be set to inherit or something else too?

  • text-indent: 0px
  • cursor: default
  • white-space: pre

aarongable pushed a commit to chromium/chromium that referenced this issue Jan 28, 2025
We were leaving some text related properties set to their
appearance:auto setting, this patch makes them inherit.
Context: w3c/csswg-drafts#11486

Change-Id: I0764f083c954e6ea3ee7084f1faa0f8f2cd1dbf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199706
Auto-Submit: Joey Arhar <[email protected]>
Commit-Queue: Traian Captan <[email protected]>
Reviewed-by: Traian Captan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1412436}
@nt1m
Copy link
Member Author

nt1m commented Feb 8, 2025

@josepharhar @fantasai provided feedback that we should probably not inherit text-indent, text-align, and text-transform, which seems sensible to me.

@josepharhar
Copy link
Contributor

If they don't inherit, then what values should they have? Should we use the values that I posted in my previous comment?

@nt1m
Copy link
Member Author

nt1m commented Feb 10, 2025

They should probably just use their initial values

@nt1m nt1m added the Agenda+ label Feb 12, 2025
@nt1m
Copy link
Member Author

nt1m commented Feb 14, 2025

@josepharhar Can you make the change in Chrome to reset text-indent, text-align, and text-transform to their initial value in base appearance? Given Chrome is shipping soon, it would be good to do.

@josepharhar
Copy link
Contributor

josepharhar commented Feb 14, 2025

After re-reading our earlier comments I realized that we weren't talking about the same properties. Should it look like this? cursor and white-space are set to inherit instead of initial:

  • text-indent: initial
  • text-align: initial
  • text-transform: initial
  • cursor: inherit
  • white-space: inherit

@nt1m
Copy link
Member Author

nt1m commented Feb 14, 2025

I'm not sure what to do with cursor or white-space, I'd be OK with status quo and filing a new issue to resolve on these

aarongable pushed a commit to chromium/chromium that referenced this issue Feb 19, 2025
This patch undoes the remainder of the CSS properties set in the UA
stylesheet for customizable select by setting the remaining properties
to either inherit or initial. Some clarification also caused me to
change text-align, text-indent, and text-transform to initial instead of
inherit. I also removed some duplicated styles. Context:
w3c/csswg-drafts#11486

I am working on a more comprehensive test to check whether these
properties are set to initial vs inherited.

Change-Id: I2a3726f9cb69bcdd3e6c093eb5c0345825dcc078
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6265540
Reviewed-by: Traian Captan <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1422052}
@astearns astearns moved this to Regular agenda in CSSWG April 2025 meeting agenda Mar 27, 2025
@astearns astearns moved this from Regular agenda to By Topic in CSSWG April 2025 meeting agenda Mar 27, 2025
@astearns astearns moved this from By Topic to Tuesday Afternoon in CSSWG April 2025 meeting agenda Mar 27, 2025
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-forms-1] Should `appearance: base` inherit more text-related properties?, and agreed to the following:

  • RESOLVED: text-shadow, text-rendering, letter-spacing, word-spacing, text-autospace all inherit, and text-transform, text-align, text-indent are reset
The full IRC log of that discussion <TabAtkins> ntim: so this is about inheriting more text-related properties in apperance:base
<TabAtkins> ntim: a few months ago i was playing with custom select in chrome, a few text properties weren't inherited
<TabAtkins> ntim: think wa sfixed in chrome, but no formal resolution
<TabAtkins> ntim: elika and i also discussed taht transform, align, and indent should not be inherited and should probably reset
<TabAtkins> ntim: any other thoughts on this?
<TabAtkins> TabAtkins: what are the properties we're adding?
<TabAtkins> ntim: there's a list in the issue
<TabAtkins> ntim: text-shadow, text-rendering, letter-sapcing, word-spacing, text-auto-space
<TabAtkins> ntim: and resetting text-transform, text-align, text-indent
<emilio> q+
<TabAtkins> TabAtkins: those all make sense to me
<astearns> ack emilio
<TabAtkins> emilio: do other form controls inherit any of these?
<TabAtkins> ntim: this is just for appearance:base, font and color already inherit
<TabAtkins> emilio: seems okay, a bit concerned about adding more dependencies from appearnce to random properties, in terms of causing confusion
<TabAtkins> emilio: but not objecting, if you think it's better that's okay
<TabAtkins> emilio: i'd just prefer to not do it if possible
<TabAtkins> ntim: the reason i filed this issue is i was doing a website and i wanted to put some inputs in a table, and wanted them to be transparent in the table, and table styles to inherit into them
<TabAtkins> ntim: just like a div
<TabAtkins> emilio: right. i don't know if introducing such strong differneces between base and auto will be a positive or negative in practice
<TabAtkins> emilio: like, this *is* something you can do today and it's already confusing for authors, adding more could be unfortuante
<TabAtkins> ntim: appearnce:base is kinda a chance to reset things and give authors a better behavior. basically the same behavior you get from a div on the page
<TabAtkins> emilio: but we're not *really* restarting, right, this value already exists
<astearns> ack dbaron
<TabAtkins> emilio: so i'm just not convinced it's much of a net benefit, but i don't want to block. just concerned it'll be more confusing than not
<TabAtkins> dbaron: almost a side comment, in support of text-indent and text-aling
<TabAtkins> dbaron: in some sense the logic of text-indent and text-align might have been better if they applied to a BFC rather than being inherited
<TabAtkins> dbaron: so it kinda makes sense to inherit those onto things that are likely to be blocks but reset on things likely to be inline-blcoks
<emilio> q+
<TabAtkins> dbaron: becuase you usually don't want them to inherit into inline blocks
<emilio> q-
<TabAtkins> dbaron: you probably don't want these to leak into the inline-block
<TabAtkins> dbaron: so given standard form styling, i think this makes sense
<astearns> ack fantasai
<TabAtkins> fantasai: +1 to what dbaron just said, that's a core part of the logic
<emilio> q+
<TabAtkins> fantasai: and the reason for blocking text-transform, unless the author specifically wants tex-ttransform to take affect, it's confusing to the user if what they see and what they type aren't the same. so authors should be explicit about this
<TabAtkins> fantasai: for the rest, i agree with Tim that the conceptual model for appearance:base is blending with the rest of the page
<TabAtkins> fantasai: and inheriting anything that affects text styles - not just font, but spacing and such as well - makes sense
<astearns> ack emilio
<TabAtkins> emilio: jsut clarifying, resetting those isn't really a behavior change
<TabAtkins> emilio: so we're in agreement there, and i generally agree with dbaron's points too
<TabAtkins> emilio: the behavior change is inheriting a bunch of new stuff (not resetting them, as we do today)
<TabAtkins> emilio: but i don't object
<TabAtkins> emilio: if we could explain it just via CSS it woudl be nicer
<TabAtkins> emilio: but this feels very cosmetic, easy to do if you need/want
<TabAtkins> emilio: i'd rather avoid the UA magic to get there
<astearns> ack fantasai
<TabAtkins> fantasai: if you think about appearance:normal, we're taking the OS appearnce and pulling it into the page. for appearance:base, we're blending it into the page.
<TabAtkins> fantasai: the styles we've set up - using currentcolor, a transparent bg, etc - achieves this
<TabAtkins> fantasai: having some things not apply is confusing for that mental model, and might not always be immediately noticeable
<TabAtkins> fantasai: as for style changing, we alreayd have to apply different props based on base or auto anyway, this is just another on the list
<fantasai> emilio, it's more magic from your point of view, but less magic from the author's point of view :)
<TabAtkins> ntim: so proposed resolution is we should inherit [the properties listed in the issue] and reset [the other properties listed in the issue]
<emilio> q+
<TabAtkins> fantasai: in other words we inherit text-tasnform, text-aling, and text-indent, and inherit everything else as normal
<astearns> ack emilio
<TabAtkins> emilio: do we mention cursor? unsure that should be inherited.
<TabAtkins> emilio: would rather go with an explicit list
<TabAtkins> fantasai: for white-space we should set it to 'pre', spaces should be visible since it's in the value
<TabAtkins> fantasai: for cursor, not sure what it normally does for text inputs, if it's different form the rest of the page we should set it accordingly
<TabAtkins> astearns: dont' think emilio was saying we should make a decision on those two properties, just because there are more complexities with styles, we should resolve on just this finite list of properties
<TabAtkins> emilio: yeah, i agree on those properties. in practice we only need to inherit some things that are reset by the UA stylesheet.
<astearns> ack dbaron
<fantasai> PROPOSED: Reset text-indent, text-align, and text-transform to initial values; set white-space to pre; and inherit all other text properties mentioned in the issue
<dbaron> I think the proposal is to inherit text-shadow text-rendering letter-spacing word-spacing text-autospace and to reset text-transform text-align text-indent
<TabAtkins> PROPOSED: text-shadow, text-rendering, letter-spacing, word-spacing, text-autospace all inherit, and text-transform, text-align, text-indent are reset
<TabAtkins> astearns: objections to these 8 properties?
<TabAtkins> RESOLVED: text-shadow, text-rendering, letter-spacing, word-spacing, text-autospace all inherit, and text-transform, text-align, text-indent are reset
<TabAtkins> astearns: a follow-on reoslution would be to have appearance:base set white-space:pre
<TabAtkins> ntim: that might be no change from current state?
<TabAtkins> dbaron: think it differs on control
<TabAtkins> astearns: another issue, then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tuesday Afternoon
Development

Successfully merging a pull request may close this issue.

3 participants