Closed Bug 56253 Opened 24 years ago Closed 21 years ago

[FIX]<input> contents inherit text-indent

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: h.b.furuseth, Unassigned)

References

Details

(Keywords: css1, testcase, Whiteboard: [CSS1-5.4.7](py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) (py8ieh:check for secondary bug))

Attachments

(2 files, 2 obsolete files)

From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; SunOS 5.7 sun4u)
BuildID:    2000100610

The contents of input boxes are indented
by the enclosing text-indent, often right
out of the box.

Reproducible: Always
Steps to Reproduce:
1. View the upcoming attachment.
2. Type in the input field.

Actual Results:  1. Contents of both text input field and
   Reset box are indented.
2. And of course the cursor can't reach the left edge.

Expected Results:   No indentation inside the fields.

Text-indent generally seems to be too aggressive.  See also:
Bug 45694 (1st line of each page is indented as a paragraph),
Bug 51968 (align=center should override text-indent)
This can be fixed by putting 
   text-align: 0;
...in the html.css rule for input and button elements.
Assignee: clayton → attinasi
Blocks: html4.01
Keywords: css1, testcase
Whiteboard: (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!)
Target Milestone: --- → Future
is this a bug in mozilla? should it be confirmed or marked Invalid?
I'd say it is.  INPUT cannot be described as a block according to CSS.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Accepting bug.
Status: NEW → ASSIGNED
These elements can be described as inline-block, though, assuming CSS3, and at
that point it _does_ become valid for them to inherit the text-indent.

(BTW, I meant 'text-indent' not 'text-align' earlier.)
Reproduced for me:                                                             
              
with 04/06/2001 nightly under WinNT4.0
with 04/08/2001 nightly under RH Linux 6.2

I have the same behaviour:  

Actual Results:  1. Contents of both text input field and
   Reset box are indented.
2. And of course the cursor can't reach the left edge.
                                                               
                                                                               
                          
OK, so putting 'text-indent: 0' in forms.css for input and button elements will
fix this. Other than that fix, which could be considered a workaround according
to dbaron's line of reasoning, we need to dramatically change how we apply style
to controls.

I'm sending this to rod s. so he can decide if he wants the new rule in forms.css

A more general bug about how style is applied to form controls should probably
be opened - there are already several specific instances recorded of that
general problem.
Assignee: attinasi → rods
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Hardware: Sun → All
Target Milestone: Future → mozilla0.9.1
Setting to 0.9.1, I will probably check in this fix as a work around.
Updating OS to All based on Vladimir's comments
OS: Solaris → All
Whiteboard: (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) → [FIX](py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!)
Summary: <input> contents inherit text-indent → [FIX]<input> contents inherit text-indent
Whiteboard: [FIX](py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) → (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!)
Index: forms.css
===================================================================
RCS file: /cvsroot/mozilla/layout/html/document/src/forms.css,v
retrieving revision 3.11
diff -u -r3.11 forms.css
--- forms.css   2001/04/18 02:56:12     3.11
+++ forms.css   2001/05/01 14:15:29
@@ -71,6 +71,7 @@
   -moz-user-focus: normal;
   -moz-binding: url("resource:///res/builtin/platformHTMLBindings.xml#inputFiel
ds");
   padding: 1px 0 1px 0;
+  text-indent: 0 ! important; /* work around for Bug 56253 */
 }

 textarea {
I am giving Ian's fix an r=rods
sr=attinasi
Hold on!

Do we really need the "!important"?

Putting it there will block content authors from having text-indents in buttons
if they want them. There is no reason, as far as I can tell, to use "!important"
in this case.
Well, it breaks if it is greater than zero, so I figure it should be !important
for all form controls.
What "breaks"? Web authors could very well intentionally use 'text-indent' on 
form controls. The only times we should use '!important' are when allowing the
author to change the value would do something like cause a crash or open up a
security flaw or some such.
Ian, I got this bug because it doesn't work "right" when not set to zero, so if 
I check it in without !important, then I am just going to see a bunch more bugs 
files on this. But then maybe I will get bugs files that it doesn't work also.
Target Milestone: mozilla0.9.1 → mozilla0.9.2
When set to non-zero it works per the spec, right? The only way that authors
could end up with a non-zero case (if you don't put !important) is if they
explicitly ask for one. So that's fine, those bugs will be INVALID and should
end up being triaged as such even before you see them.
Ian, no it is all screwed up when non-zero. So I want to keep them from making 
it anything but zero so it behaves correctly.
Is there a bug about how it is all screwed up?
Whiteboard: (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) → (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) (py8ieh:check for secondary bug)
Ian, I thought THIS was the bug about how it is screwed up.
Oh. Well in that case, the fix that is given above, with sr=attinasi and r=rods,
is not a valid fix. It's a band-aid workaround, and as such should not be 
checked in on the trunk.
Wait. If this is the bug about text-indent not working correctly on form 
controls, then which is the bug about text-indent being inherited into 
form controls by default, which is also a bug? Is this bug covering both
issues? I'm confused...
*** Bug 83895 has been marked as a duplicate of this bug. ***
Attached patch more precise fix (obsolete) — Splinter Review
As it turns out, text-indent, whether it is inherited or as inline style breaks 
all form controls except text fields and textareas. This new patch will fix 
that.

Please give it an r=
We should not let the text-indent be set if we are not prepared to handle it
correctly in the form elements.
patch looks good.
r=kmcclusk@netscape.com
sr=hyatt
Blocks: 83989
Is there instead a pseudo-element inside the form controls on which you could
specify the 'text-indent' (where you wouldn't need the !important)?  (Do
!important rules in ua.css reduce the effectiveness of the memory reduction in
hyatt's new style stuff?)
David, good suggestion (see new patch). The only question is whether I should 
add the rule to the input file to keep the text in the text portion from sliding 
over. I can go either way with that. 
I still don't think we should check in this work around into the trunk.

There are two bugs here: 

First, text-indent being inherited by default into form controls. The fix for 
that is simple -- It's 
   http://bugzilla.mozilla.org/showattachment.cgi?attach_id=37519
...but without the !important declarations.

Second, form controls don't support text-indent. This is the main bug that 
should be fixed, although I don't think any attempt has been made to fix it.
Ian, I think doing this on the pseudo-elements inside the form is perfectly
reasonable, although I admit the controls could be designed differently, there's
no need for them to be.

Are there any cases that the first patch fixes but the latter patch doesn't?
I'd prefer to approve the latter one but it doesn't have r=/sr=.

We shouldn't let text-indent mess up form controls -- form controls are a black
box as far as CSS's rendering model is concerned.
dbaron: As we both know, that's one of the few things on which we have a 
technical disagreement. :-)
Complex issue, moving off to future milestone
Target Milestone: mozilla0.9.2 → mozilla1.1
I was hoping you'd check one of those fixes in -- I'd rather not support
text-indent within form controls (if there is such a thing) than do it wrong...
No longer blocks: 83989
*** Bug 112174 has been marked as a duplicate of this bug. ***
Attachment #37519 - Attachment is obsolete: true
Priority: P3 → P2
Target Milestone: mozilla1.1 → Future
Whiteboard: (py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) (py8ieh:check for secondary bug) → [CSS1-5.4.7](py8ieh: contact WG -- text-indent will inherit into inline-blocks!!!) (py8ieh:check for secondary bug)
*** Bug 139286 has been marked as a duplicate of this bug. ***
Thanks to bz for finding my bug as a dupe of this one.  I figured someone knew
about it.

Question:  What about the other block-level-only properties?  In CSS2, I count
only about 12 of them, total.

The patch suggestions have probably bitrotted by now; any chance of a workup for
1.0 or 1.1??
*** Bug 171733 has been marked as a duplicate of this bug. ***
*** Bug 204891 has been marked as a duplicate of this bug. ***
.
Assignee: rods → form
Status: ASSIGNED → NEW
Component: Layout → Layout: Form Controls
Priority: P2 → --
QA Contact: cpetersen0953 → desale
Target Milestone: Future → ---
I see nothing "all screwed up" in any of the testcases attached to this bug, so
I don't see a reason to make these !important unless we really feel that users
should not be able to set text-indent on these form controls.
Attachment #37636 - Attachment is obsolete: true
Comment on attachment 135462 [details] [diff] [review]
Ok, we should just do this

David, if you think we should do !important let me know and I'll add that
before checking in.  The <option>, <optgroup>, <button>, etc don't have
anonymous kids, so the only ones we could use anonymous content for easily are
text and textarea inputs.
Attachment #135462 - Flags: superreview?(dbaron)
Attachment #135462 - Flags: review?(dbaron)
Attachment #135462 - Flags: superreview?(dbaron)
Attachment #135462 - Flags: superreview+
Attachment #135462 - Flags: review?(dbaron)
Attachment #135462 - Flags: review+
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: