Closed Bug 247068 Opened 20 years ago Closed 20 years ago

[FIXr]fieldset border should be drawn in legend's margin

Categories

(Core :: Layout: Form Controls, defect, P1)

x86
Windows 98
defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: ve3ll, Assigned: bzbarsky)

References

()

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7) Gecko/20040614 Firefox/0.9
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

an assumption was made that legend position was fixed so top left horline only
drawn xx pixels...  My example offsets the legend by margin:200px to
emphasize that the top left hor line of the fieldset should be done on a
calculated basis respecting the offset of the legend element.  Note that
other browsers handle this correctly.  I view this as a cosmetic bug but 
was a programmer assumption -- ass/u/me was an old Benny Hill skit ;-] ;-]

Reproducible: Always
Steps to Reproduce:
1. simple fieldset / legend structure
2. use css to margin offset the legend by 100 px or so
3. note the way the fieldset is rendered

Actual Results:  
disconnected fieldset box

Expected Results:  
box border up to but not thru legend element
Could you attach a test case? (With CSS and HTML inline)
here is the test case as requested -- stripped to minimum !
key is margin-left setting in legend !!!!

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Legend Styling - VE3LL@RAC.CA</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">body {margin:40px; background:blanchedalmond}
legend {margin-left:200px; background:thistle; border:black 1pt solid;
        padding-left:4px; padding-right:4px}</style></head>
<body><h1>Legend Styling - VE3LL@RAC.CA</h1>
<fieldset><legend>Howdy Doody</legend>
<textarea name="x" cols="70" rows="13"></textarea>
</fieldset></body></html>
Attached file test case
bz, ian; do we want to ignore 'margin' completely for the LEGEND element? Since
it isn't specified how it should be styled? (Opera does that.)

Or just marking this bug invalid?
I don't see why we would... It should just work like a positioned element, I 
think, and those don't ignore margins.
The action of margin is well defined by css as to how it is applied.
Most elements can have margin applied.  Defining whether something
should be implemented or not should never be determined by the action
of a single browser as that browser may be in error (opera has plenty
of quirks yet too!). First follow the w3 spec.  And where it is vague
see what the concensus is of all major browsers...
But in this case the recommendation is clear !!!
Oh yeah -- someone should send a bug report to opera too...
they have too many on file from me and some get lost. 
A fresh reporter may mget a faster response from that group. 
> But in this case the recommendation is clear !!!

Please, tell me where the W3C says anything useful about styling form elements,
which are _different_ from normal elements; that is for sure.
w3.orgs css recommendation 2.1 section on box models
sub section 8.3 on margins clearly states that margin
applies to ALL elements. No distinction is made for
form elements and in fact the form element nester itself
is no longer needed if submission to cgi or email is
not required ...  what distinction do you give a 'form'
element ?? 
But section 3.2 says: "CSS2.1 does not define which properties apply to form
controls and frames, or how CSS can be used to style them. User agents may apply
CSS properties to these elements. Authors are recommended to treat such support
as experimental. A future level of CSS may specify this further."

However, I do think we should apply margins to <legend>.
In reality recommendation 3.2 does not apply because
legends ( as well as fieldsets ) are NOT form CONTROLS
but are structural elements that can be but rarely are
applied elsewhere.  CONTROLS are feedback elements such
as input areas and buttons that allow user interaction.
Legends and fieldsets do not offer user interaction so
they do not fall under the 3.2 'compliance not required'
paragraph. It is an issue of appearance whichcould be easily
remedied. Even the Amaya browser group (say 5 people at most)
got it done... Surely it is doable by this august group!  
Unless you can describe the rendering completely using CSS, then it applies.
And one can't describe rendering completely for legend ????
It is almost right --- Legend IS positioned correctly.
It is really the rendering of fieldset that is incorrect
as the horizontal line is not drawn horizontally from the
upper left corner to the legend box. The right side line
is drawn from the box to the right corner. Unsymetric...
It was just a slipup in drawing the fieldset box so why
can't it be fixed after existing from the old days of Net 7.1
No, you are wrong. How to describe...

 <fieldset>
  <input>
  <legend>test</legend>
 </fieldset>

... using CSS. Note that LEGEND has a attribute for it's position, which Mozilla
supports.
Assignee: dbaron → nobody
Status: UNCONFIRMED → NEW
Component: Style System (CSS) → Layout: Form Controls
Ever confirmed: true
QA Contact: ian → core.layout.form-controls
Summary: fieldset not drawn right to legend box → fieldset border should be drawn in legend's margin
So the real question here is how exactly the messed-up border of the fieldset
behaves...  Note that it is NOT painted under the legend in general (the default
background on legend is "transparent" and you can't see the border there).  So
the question is what's considered "under the legend"...  In my mind, that should
not include the legend's margins.
one clue as to the problem is revealed when one does a
test file that has NO fieldset, only a legend!
For some reason the framing lines are still drawn ???
Other browsers simply lay the legend element over the
nesting fieldset (which draws the framing border)
 <body>
    <legend style="margin-left:100px">test</legend>
 </body>
should not have any framing lines... other stylings 
should apply 
adding a fieldset around the legend should draw the lines...
both legend and fieldset are styling elements and not form controls.
Fieldset is used for grouping and in fact has an active component 
for radio button interdependence. If border or outline rule was 
available, it could also be used as a visual framing tool for GUI
design.  legend is intended as a captioning device which to me implies
textual or visual so perhaps even background-image could be set. 

Although nothing is stated in CSS, it is customary for the legend element
to be drawn as margin offsets (both right and top[negative] ) of the nesting
fieldset block element. These offsets should be adjustable thru style rules
to aid designers. 
John, the point made earlier (comment 11) is that the default rendering of
fieldset/legend as implemented by today's browsers is not describable via CSS
(try taking a pair of nested divs and making them render the way browsers render
fieldset/legend; if you come up with a solution, feel free to email it to me
privately and I'll poke holes in it).  So the CSS spec does not in fact fully
specify the rendering of fieldset/legend as things stand.

All of that is not really relevant.  The problem description is in comment 14;
all we need to do, imo, is to decide what behavior we want for the border of the
fieldset.  I don't think anyone's seriously advocating not applying margins to
legend.
This will still have issues if the top/bottom margins are large and of
different sizes, but it improves the left/right margin handling, in my opinion.
 The only change is to paint the fieldset border under the margins of the
legend (mLegendRect includes the legend margins).
Comment on attachment 152973 [details] [diff] [review]
Somewhat of an improvement

David, what do you think?
Attachment #152973 - Flags: superreview?(dbaron)
Attachment #152973 - Flags: review?(dbaron)
Comment on attachment 152973 [details] [diff] [review]
Somewhat of an improvement

looks fine, although a comment explaining why would be nice
Attachment #152973 - Flags: superreview?(dbaron)
Attachment #152973 - Flags: superreview+
Attachment #152973 - Flags: review?(dbaron)
Attachment #152973 - Flags: review+
OK.  Will add a comment at checkin time.
Assignee: nobody → bzbarsky
Priority: -- → P1
Summary: fieldset border should be drawn in legend's margin → [FIXr]fieldset border should be drawn in legend's margin
Target Milestone: --- → mozilla1.8beta
Fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 267710 has been marked as a duplicate of this bug. ***
*** Bug 263001 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: