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

Disable fieldset/legend rendering magic with CSS #3912

Open
zcorpan opened this issue Aug 13, 2018 · 9 comments
Open

Disable fieldset/legend rendering magic with CSS #3912

zcorpan opened this issue Aug 13, 2018 · 9 comments
Labels
addition/proposal New features or enhancements needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan topic: fieldset topic: rendering

Comments

@zcorpan
Copy link
Member

zcorpan commented Aug 13, 2018

Today I asked on Twitter

If you could specify some CSS to make a <legend> act like a normal element, what would it be, ideally?

https://twitter.com/zcorpan/status/1028999908433571846

answers so far

It feels that should be the role of display: block or display: inline

(It's display: block by default. Sites change the display value (to inline-block, table...) and expect the magic legend rendering.)

Given that the magic rendering of occurs only inside

and the latter has other "magic" rendering features (e,g, BFC root and min-width: min-content; by default), maybe it would be better to "turn off" this "magic" on the level?

I would try appearance: none, like many others, only for .

appearance: none? And by default it would have appearance: legend?

first thing that comes to mind is setting "appearance" to "none" but i admit that i'm a little ignorant to the history of that property

Yeah, it definitely makes sense for this to be on <fieldset>. Could maybe be useful to also have it on <legend>, but inherit the value from <fieldset>, to allow for keeping the special styles on <fieldset> without the special placement of <legend>.

(Just for clarification, I think I've always removed browser styles from <fieldset> and <legend> at the same time, so I personally wouldn't need appearance on <legend> if it were on <fieldset>, and definitely would want it on <fieldset>. But someone else might need it on both?)

appearance: none is what I thought about before writing the tweet, also. Since float and position:absolute/fixed on the legend disentangles the legend, I thought appearance: none would go on the legend, but I suppose it could go on the fieldset instead.

Any preference on the implementation side, if we are to do this? cc @bzbarsky

@zcorpan
Copy link
Member Author

zcorpan commented Aug 14, 2018

Related issue which also discusses appearance: none, #2805

@zcorpan
Copy link
Member Author

zcorpan commented Aug 14, 2018

I see 22 resources in httparchive that set 'appearance' on fieldset or legend:

https://gist.github.com/zcorpan/53efbbe20df21f10dbdd5e1368c790c4

I have not yet analyzed these.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 14, 2018

Of those 22, there's only one that actually has a <fieldset>

rank page url match
245049 http://www.bigsquidrc.com/ http://www.bigsquidrc.com/wp-content/cache/minify/63fbe.css fieldset{-webkit-appearance:none;border:0;margin-bottom:25px;text-align:center}

As far as I can tell, it wouldn't render differently if the fieldset was a div.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 14, 2018

First draft of a proposal at https://docs.google.com/document/d/1JM0YmKNRmhl1nEqcg_M_KlxBg_q7LIz9xgzmbrHp34o/edit?usp=sharing

This would allow appearance: none on the fieldset to remove the BFC, the forced 'display', the legend association. It also allows appearance: none on the legend to remove the BFC, the forced 'display', shrink-wrapping, alignment (or not?), and the special placement. It would also allow authors to specify these styles on other elements.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 17, 2018

The above doc received some comments from @MatsPalmgren (thanks!). I will preserve those comments there, but have now changed sharing such that new comments are not accepted.

I have made a pull request that supersedes the doc; comments welcome there.

#3934

@zcorpan zcorpan changed the title Disable fieldset/legend magic with appearance: none on one of them Disable fieldset/legend magic with -webkit-appearance: none Aug 20, 2018
@zcorpan
Copy link
Member Author

zcorpan commented Aug 27, 2018

zcorpan added a commit that referenced this issue Sep 14, 2018
TODO explain what this does.

Fixes #3912 (TODO more issues).
@zcorpan zcorpan added the needs implementer interest Moving the issue forward requires implementers to express interest label Oct 17, 2019
@zcorpan
Copy link
Member Author

zcorpan commented Oct 17, 2019

The PR for this is #4035
Tests at web-platform-tests/wpt#12677

@MatsPalmgren @mstensho is there still interest in solving this issue?

@zcorpan
Copy link
Member Author

zcorpan commented Mar 20, 2023

See #4035 (comment) - leaving this issue open to come up with a different way to opt out of fieldset/legend magic rendering rules.

@zcorpan zcorpan changed the title Disable fieldset/legend magic with -webkit-appearance: none Disable fieldset/legend rendering magic with CSS Mar 20, 2023
@annevk
Copy link
Member

annevk commented Mar 20, 2023

WebKit would be interested in solving this.

@zcorpan zcorpan added needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan and removed needs implementer interest Moving the issue forward requires implementers to express interest labels Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan topic: fieldset topic: rendering
Development

Successfully merging a pull request may close this issue.

2 participants