Edgewall Software

Opened 14 years ago

Closed 13 years ago

#7932 closed defect (duplicate)

A header with contents 'attachments' is rendered inside a box.

Reported by: stephenemslie@… Owned by: Remy Blank
Priority: normal Milestone:
Component: wiki system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


This may not strictly be a bug, but is unexpected behavior. Headers have their id set to their contents so they can be linked to, but this also means it receives styling from #attachments in trac.css. Is it possible to be more specific with the #attachments selector (e.g. div#attachments) to prevent this unexpected behavior?

The wiki syntax that produced this is:

== attachments ==

Which produces the following html:

<h2 id="attachments">attachments ... </h2>

And looks like this:


Attachments (0)

Change History (4)

comment:1 by Remy Blank, 14 years ago

Milestone: 0.11.3
Owner: set to Remy Blank

Good catch. As a temporary workaround, you could set a custom id on the header, like so:

== attachments == #attachments_id

Which looks like:


Still, your proposal makes sense. I'll put it on my to-do list.

comment:2 by stephenemslie@…, 13 years ago

I haven't tried yet, but it should follow that any header tag can accidentally inherit style from css id selectors that are unspecific about which type of element they apply to.

A cursory grep over the css source came up with about 300 selectors starting with #. This issue could come up on any page with one of these present. It would be a pain to change every one of these selectors for a minor issue such as this, but perhaps it is a good idea nevertheless?

comment:3 by Remy Blank, 13 years ago

Yes, I thought about that, too. Ideally, all "hardcoded" element ids should have been prefixed e.g. with trac_ or something similar from the beginning, to avoid name clashes. You could argue that you can always provoke them, but at least it's less obvious than attachments.

But changing all ids now would not only be a pain, but also break many extensions, whose stream filters often rely on ids to insert their content.

So your solution of making the CSS selectors more precise seems like a good compromise, as it would limit most breakage to Trac itself, where we can fix it easily.

comment:4 by Remy Blank, 13 years ago

Milestone: 0.11.3
Resolution: duplicate
Status: newclosed

It seems that a clean namespace for CSS selectors has already been requested in #5997, and it would solve this issue as well, so I'm closing this as a duplicate.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.