I have found a number of browsers (Firefox for example) that ignore CSS style overrides for the legend tag that is inside the fieldset tag.
This becomes a problem when trying to make a custom theme that overrides the look and feel from the standard drupal way.
After some research, I found that putting a span tag inside the legend tag (wrapping the legend text) is a successful work-around that does not break normal behavior.

I am requesting that this workaround be implemented upstream.

I have attached a patch that makes the obvious changes needed to wrap a fieldset legend.

Here is some example CSS that overrides the fieldset with the attached patch:

div.node-form div.standard fieldset {
  position: relative;

  border: 1px;
  padding: 0px;
  margin: 0px;
  
  left: 0px;
}
  
div.node-form div.standard fieldset legend span {
  display: block;
  position: relative;

  font-size: 16px;
  font-weight: bold;

  line-height: 19px;

  background-color: #b0b0ff;

  border-style: ridge;
  border-width: 2px;

  padding-left: 8px;

  width: 1238px;
  left: -2px;
  right: auto;
}

Without the patch (and removing the trailing span from div.node-form div.standard fieldset legend span {) the legend would fail to be changed via CSS.
This is primarily a Mozilla bug.

CommentFileSizeAuthor
#1 drupal-6.x-wrap_legends-3.patch2.26 KBthekevinday

Comments

thekevinday’s picture

StatusFileSize
new2.26 KB

I thought i already uploaded the patch with this post..

Either way, I found a case where it does break behavior.
When the javascript fieldset collapsed is called and a fieldset collapses, having the span in between the text somehow causes the entire field legend to vanish..
The fix was easy, in the system.css, the span (html.js fieldset.collapsed legend a span) simply had to be set to inline.

This fix is present in the attached patch.

Shai’s picture

I'm having problems with Firefox that I think are related to this. What ever became of this issue?

Shai

damien tournoud’s picture

Status: Active » Closed (won't fix)

This can be overridden in your own theme if you want. It doesn't feel like there is any need for this additional tag in Drupal core themes.

thekevinday’s picture

Status: Closed (won't fix) » Needs review

I apologize for re-opening this but:

The problem is that it cannot be overriden by CSS precisely because webbrowsers that I have tried do not respond to CSS with the fieldset tag.

Without this patch, the my own themes cannot apply changes to the fieldset tag.

Given the amount of time that has passed since I created this bug report, I need to re-check all major browsers to see if this problem still exists.
If the problem is resolved in all recent major webbrowsers then I will close this.

yched’s picture

Component: field system » forms system

Not a Field issue.

Status: Needs review » Needs work

The last submitted patch, drupal-6.x-wrap_legends-3.patch, failed testing.

mgifford’s picture

Is this still an issue that should be moved forward to D8? Or should it be closed?

thekevinday’s picture

I am not sure what the status of it is in drupal 6 as I have moved most of my activities on to drupal 7.
Drupal 7 seems to have already implemented the fix now that I look at it.

It could be marked as Fixed, but that depends on what you want to do with drupal 6.

mgifford’s picture

Status: Needs work » Closed (won't fix)

If we find the patch that fixes it, we could ask for a backport to D6, but at this stage I think we might as well mark it as closed.

Unless someone wants to take this on and push it through.