-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
HTML spec is unclear about how buttons are sized in non-inline contexts (and browsers disagree) #2948
Comments
Please STOP Quirx Mode version 1.1. The replaced elements make many of problems for developers. On the Stack Overflow is many of question why cannot position left+right (for stretching) for input, textarea, select etc. Time to end this. From W3C RECOMMENDATION specification (current and actual):
In the text are elements: video, audio, object, applet, embed, iframe, canvas,
It means: replaced elements are only IMG and INPUT of type image. I think "inline-block" is the initial state of the input type other than image button element, button and other specified. If you use position:fixed, the inline-block is converted to "block" due to CSS specification. It means the form elements and controls except of input with image type are not replaced elements and box model shall be the same like for non-replaced elements, and the box shall be filled with content of the form control. |
This seems related to https://www.w3.org/Bugs/Public/show_bug.cgi?id=23893 which is awaiting input from @tabatkins. |
All input types are at least "semi-replaced". We're still not really sure how that state works; it's not fully a replaced element (it doesn't size like one, and responds to some properties), but still has some notion of an "intrinsic" size that it likes to obey (unlike normal elements) and is unbreakable. That example of an inline breaking across lines would unfortunately be a complete break with current web compatibility. (So yeah, bug 23893 is def still waiting on me, but the CSSWG in general doesn't know the answer to it yet. fantasai and I will move toward defining it eventually...) |
New term: semi-replaced. Quirx mode v1.2. The Quirx Mode 1.0 was the differemces between IE and other browsers - problem of interpretation of width etc. For button IE, Firefox and Chromium is able to "Abspos" internal elements out of button. Is it really problem to make BUTTON a standard element (non-replaced) defined for example initially as
and add to the element appropriate events? It will be more annoying if specification will define third type of elements named "semi-replaced". It is weird. |
Doesn't matter if it's more annoying or not (it definitely is!). It's required for web compat. Buttons never linebreak, even if they are set to (Tangent: Why are you spelling it "quirx"? It's "quirks", as in the plural of "quirk".) |
But... document definition Btw Quirx is quirky like Quirx Mode. This was on purpose and not coincidence. One behaviour for rendering all elements (except video, audio etc.) will be faster and more foreseeable than more (replaced, non-replaced, semi-replaced). The IE renders BUTTON in html5 mode also like tabe-row, table-cell, table and MAKES IT CORRECTLY due to actual W3C Recommendation. One bug, probably: compatibility with firefox, IE doesn't set full with in block-mode for BUTTON. I checked it on IE11. |
There's no such thing as a separate "HTML4" vs "HTML5". It's all HTML and is parsed and displayed in the same way. (Plus |
Like shebang for sh scripts. Does IE6 and older IE and older browsers interpret correctly The html5 for Polish, Deutsch and Czech pages cannot be compatible. Characters will be encoded wrongly. Additionally html4 base on SGML, html5 not. The old browsers doesn't support utf-8 and default charset was windows-1250 or iso-8859-1. Additionally older browsers sets "quirks mode" for definition |
@Nadya678 you're getting off-topic, please take this elsewhere. Older browsers indeed interpret |
https://pl.wikipedia.org/wiki/Quirks_mode NS6 and Konqueror 3.2 also? The |
BTW. One of solution for this problem is addition of the attribute Additional style also can be added to CSS. For example All old sites will be rendered "correctly" in new browser and developers will be happy after any time after implementation of this attribute. Definition of replaced="false" will be: the form control is treated as "non-replaced" element like |
...and I can't agree that it is good. Not often, but still there are certain situations where this limitation really annoys developers and forces them to resort to non-semantic workarounds like I think it should be a CSS way, since there already is a (rather hacky) CSS workaround that makes it possible to linebreak a button. without breaking existing content (supported in Chrome behind the flag). Maybe a new value of |
But I want to implement real application - online editor for government documents and online editor for CV. In these documents the additional blank area are not permitted. I want to have input type="..." (text, non-replaced, for example with argument "replaced="false") that can be linebreak. I want the data form document send via https (thus: this must be input or textarea) and I don't want to use JS. Only CSS and html. I want also to print the document. If "display: inline" will not apply "inline-block" for elements with attribute replaced="false" I will be able to make it. At the moment I can only write a JAVA application that has this appearance or more JS that edit SPAN and sends form via XmlHttpRequest (very disguisting solution and non-semantic...) If textbox will be possible to linebreak, I don't see arguments to disallow button to linebreak. It can be non-practical but all elements shall behave the same manner. |
This specifies the layout model of buttons (the button element, the input element in the Button, Reset, Submit states, and the button part of input in the File Upload state). Fixes #1024. Fixes #2948. Fixes #4081. Part of #4082. Tests: web-platform-tests/wpt#14824 Bugs: https://bugs.chromium.org/p/chromium/issues/detail?id=962936 https://bugs.webkit.org/show_bug.cgi?id=197879 https://bugzilla.mozilla.org/show_bug.cgi?id=1539469
The HTML spec says this about button rendering:
And this about
<input type="button">
rendering:Most other form controls (e.g. checkboxes) have similar language. And in this HTML spec-text,
inline-block
is just a link to the CSS definition fordisplay:inline-block
.So, my question: how should these elements render (and be sized) if they've been styled with
display:block
(either by directly setting it, or by floating/positioning)? In particular, should browsers apply the CSS sizing rules that apply to non-replaced block-level boxes in that case? (and fill the container, if the element haswidth:auto
) Or should browsers apply the sizing rules for replaced block-level boxes?From my testing, Firefox, Chrome, and Safari seem to size form controls as replaced elements (whether they're inline-level or block-level), which makes sense to me, but which seems to disagree with the HTML spec (which lists "form controls" in the "replaced elements" section at https://html.spec.whatwg.org/multipage/rendering.html and which seems to only specify image-typed input elements as being explicitly replaced).
Edge/IE [edit: and also Safari, actually] also does this in some cases, but they don't in one special case, so I'm not sure whether they consider these elements to be replaced or not. Here's a testcase: https://jsfiddle.net/ap6sb9oo/
Edge (and IE) disagree with all other browsers about the third line there -- they render the button as the width of the full viewport, which is only correct (per CSS) if the element is non-replaced. (But if they view the element as non-replaced, then I don't see why they'd give it the shrinkwrap treatment when it is
display:block
).The text was updated successfully, but these errors were encountered: