Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
30 Apr 2004 at 04:04 UTC
Updated:
29 Jul 2014 at 17:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
ax commentedargh! - IE "save as text" escapes >s ... please take this ok patch.
Comment #2
Steven commentedCommitted.
Comment #3
dries commentedUnConeD, what would happen when the description uses HTML code?
Comment #4
Steven commentedGood point... I took a look at drupal_attributes() though, shouldn't it be running values through drupal_specialchars?
In the meantime I guess a strip_tags would do it. Though, should we strip newlines as well? A test here shows the IE can handle newlines in title attributes (and displays them properly in the tooltip), while Firefox doesn't (displays them as odd symbols).
With titles being used more and more we could use a generic title-sanitation function.
Comment #5
moshe weitzman commentedWe currently use taxonomy descriptions as title attributes in glossary.module and taxonomy_dhtml.module. I agree with using strip_tags() but please don't strip linebreaks. They are very useful for long glossary definitions and such.
Comment #6
ax commentedi had thought about html in descriptions and even tested it. balanced html works and is displayed as-is in the hover popup. what doesn't work would be a description like
">ending the <a tag
as the descriptions (as part of the taxo admin) are normally done by trusted users who know what they are doing, as this may be useful for some descriptions, and to keep things simple, i think it is safe to use as it is now.
the "generic title-sanitation function" steven suggested might be helpful, though.
Comment #7
nedjoThere are two issues produced by the use of term descriptions in title attributes.
The first, suggested above, is caused by HTML in the title attribute.
Consider a category with the following description:
This category is about <a
href="http://www.drupal.org">drupal</a>.
When enclosed in a title attribute, this becomes
<a href="taxonomy/term/4" title="This category is about <a
href="http://www.drupal.org">drupal</a>.">drupal</a>
which is invalid XHTML because of the quotation marks and generates display errors. Here's an example link (hold mouse over to see popup):
drupal">drupal.
Therefore, we should indeed use strip_tags().
The second issue is that some taxonomy descriptions may be longer than is appropriate for use in a tooltip popup, leading to (a) large downloads and (b) display ugliness. This latter issue is reported in the post
http://drupal.org/node/9491. It will be a particular issue for users who use the taxonomy_context.module, which provides support for displaying extended descriptions (equivalent to the body of a node) and any other modules making similar use of the term descriptions.
The attached patch addresses both length and HTML issues in term descriptions used as title attributes. It passes term descriptions through node_teaser() and then strips out tags before returning them. The result is a shorter (where necessary), tag-free display, appropriate for the title use.
Comment #8
marqpdx commentedhi All,
I'm a user of the last feature. I have a moderately extensive description in my taxonomy items. i then assign the taxonomy url to a menu item, and when the user clicks on it, they go to what amounts to a "Landing Page" for all the items in the Taxonomy (thanks to the Taxonomy_Context module), the description serving as static text that comes before all nodes which are added.
If description is supposed to function well as a tool tip, it shouldn't be a text area, but a single line (text input), and there should be another data element for the taxonomy. Perhaps breaking the description into two pieces, the ShortDecs (tool tip) and the LongDesc for use with taxonomy_context and other modules.
I'm new enough i don't know how to implement this, but i wanted to add my two cents.
Thanks,
mark
Comment #9
marqpdx commentedSorry for taking up an extra page here, but my crucial bit is that my design calls for anchors in the description, b/c of my Landing Page feature, so when i found that not to work, i was trying to find another way. Still working on it.
mark
Comment #10
dries commentedI removed the title attribute from these links. The proposed solution is a bit of hack, and so is the idea of a 'generic title sanitation function'. If we want this back, we need to introduce a textfield that can be used to provide a link description.
Comment #11
killes@www.drop.org commentedI consider this a feature request.
Comment #12
ñull commentedJust adding an idea here. Why not use the
here too? The hover-over-titles could be before this tag.
Comment #13
ñull commentedSorry, but the break tag was filtered out, and used, of cause. Well, I guess that you know now what I mean!
Comment #14
LAsan commentednedjo: still a feature request?
Comment #17
mdupontComment #18
mgiffordThis is a simple 2 line patch that's been open since 2004. It's probably too late for D8, but should be something the UX folks should be looking at if it's going to get in at all.
Otherwise, let's close it.
Comment #19
mgiffordSo much has changed within core/modules/taxonomy/taxonomy.module
I'm going to just close this for now, but feel free to re-open it if it is something that will be useful for you.