Opened 17 years ago
Closed 17 years ago
#7932 closed defect (duplicate)
A header with contents 'attachments' is rendered inside a box.
| Reported by: | Owned by: | Remy Blank | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wiki system | Version: | 0.11.2.1 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
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
Attachments (0)
Change History (4)
comment:1 by , 17 years ago
| Milestone: | → 0.11.3 |
|---|---|
| Owner: | set to |
comment:2 by , 17 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 , 17 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 , 17 years ago
| Milestone: | 0.11.3 |
|---|---|
| Resolution: | → duplicate |
| Status: | new → closed |
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.



Good catch. As a temporary workaround, you could set a custom id on the header, like so:
Which looks like:
attachments
Still, your proposal makes sense. I'll put it on my to-do list.