The 'filtered HTML' text format doesn't allow the span tag by default. For accessibility, language changes should be marked ('language of parts').

For inline texts, the <span> tag is used for this, for example:
<span lang="de">Ich bin ein Berliner</span> is a quotation from a speech by President John F. Kennedy.

If there is no harm to add the tag by default, it will help us to make Drupal compliant to ATAG ('Authors must be supported in producing accessible content').

CommentFileSizeAuthor
#11 1322906-11.patch1.34 KBxjm
#1 patch_commit_987c9bc2f8f1.patch1.39 KBhanno

Comments

hanno’s picture

Status: Active » Needs review
StatusFileSize
new1.39 KB

Initial patch provided.

hanno’s picture

Issue summary: View changes

typo

hanno’s picture

Issue summary: View changes

corrected text format name to 'filtered HTML'

hanno’s picture

Issue summary: View changes

typo

hanno’s picture

mgifford’s picture

Makes sense to me. What are the possible concerns from a system perspective?

hanno’s picture

In discussions about adding more tags there is a concern on tags that breaks the design.
#256552: Allow more html tags by default.
#514008: Allow HTML headings in default Filtered HTML text format
#1286136: <p> should be a default in "Filter HTML Tags"
The <span> tag however, provides no visual change. It is an invisible helper for textgroups.

Another concern can be security. In the first discussion span is mentioned as a safe tag, but I can't find a reference. This patch doesn't include a patch for filter_xss. Should we add 'span' there as well?

Everett Zufelt’s picture

My concern is how to communicate this to authors. WTF does span mean?! Would be the response of most authors. Of course, this is likely similar for most tags.

hanno’s picture

In this patch a help text for the span tag is included for the 'More information about text formats'-link:

Group part of a text (i.e. for language): <span lang="fr">C\'est la vie</span>

hanno’s picture

Note that there is no help text provided for users for the default <li>, <dt> and <dd>, but that is another issue, that help page needs some usability attention.

We might also suggest to print the tags to end users with the description as a mouse over (using the definition tag?). tags like LI, DT etc are abbreviations/technical terms that actually might need tagging in respect to WCAG2 3.1.3 Unusual Words and 3.1.4 Abbreviations (both level AAA).

Bojhan’s picture

Assigned: Unassigned » sun

This makes sense, but needs feedback from the maintainer. I do not really expect we can fully inform the user about this option, but we can do our best .

sun’s picture

Issue tags: -language of parts

The actual use-case here is a citation, for which there is the cite tag already.

Which other actual use-cases are not covered by existing elements, for which we'd have to allow span tags?

That said, regardless of that answer, I'm pretty much opposed to this change, as it assumes that end-users (regular visitors/users of a site) would understand this detail of HTML, and, that they would actually markup their content accordingly. That's likely a fraction of <1%... For the other 99%, the span tag is needless visual clutter in filter tips.

sun’s picture

Assigned: sun » Unassigned
xjm’s picture

StatusFileSize
new1.34 KB

I don't think adding <span> to the tag list is any markedly more cluttered than the clutter we already have.

I actually add <span> on multilingual sites for exactly this reason. Given that most users probably don't know they're supposed to do this, having a documented example in the filter tips seems reasonable. On the other hand, 99% of what <span> gets used for on the web is dubious inline CSS.

Attached just rerolls for core/.

droplet’s picture

-1

I think it's less than 1% of site use it. If you are the 1%, enable it yourself, super easy, no extra modules, no extra coding.
abbr tag is more valuable to add in but I opposed it too.

no one read drupal tips to learn how to type in C'est la vie. Even users know it, they may not use it. Try to open your own site and check how many abbreviation do not using ABBR.

C'est la vie

xjm’s picture

One could also point to the slippery slope here: If we add span for a very small use case, then how many other tags with very small use cases would we add if we were consistent?

mgifford’s picture

Drupal has started down the road to provide enterprise support for multi-lingual sites since Drupal 6. In Drupal 8, as with Drupal 7, this is going to improve.

I'm guessing that less than 1% of all Drupal sites will be fully bilingual. ~95% of all Government of Canada sites will be. Same with the Netherlands I expect.

If we're looking at a 1% challenge (which frankly is a popular number toss about these days), let's look at the allowed code:

<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>

I know that most folks haven't used definition lists in more than 1% of their posts. So why is that list there? Probably because it allows for good semantic presentation for 1% of content.

The main objection I can see to not including SPAN is that it makes the options slightly more complicated.

droplet’s picture

when do we add these tags:

<cite> <dl> <dt> <dd>

is multi-lingual sites the only reason to add this tag?? can't move to Locale module? (but I don't think it's the right way too, just an option better than add by default installation)

IMO, Filtered HTML should only included basic typography elements that could formatting text to provide visible effects.

hanno’s picture

I suppose abbr is not included as that is WCAG level AAA and we are aiming for WCAG level AA and ATAG2.0 level AA (well, DL, DT and DD is level AAA, so don't know why these tags are included by default?).

When span isn't included, Drupal seems to me not compliant with ATAG 2.0 B.2.1., but correct me if I am wrong.

sun’s picture

Status: Needs review » Needs work
  1. The default allowed tags in Filtered HTML are mainly supposed for visual formatting. On a level that end-users of your site (i.e., visitors) are able to understand (hopefully). Even if a definition list might be a 1% use-case, the elements are clearly defined and produce a unambiguous formatting.
  2. Just look at the patch, and at the filter tip. Now presume you don't know HTML. I can tell you what you're going to do:
    To say "Good morning" in German:
    <span lang="de">
    <blockquote>Guten Morgen!</blockquote>
    </span>
    
    Depending on the time of day, different variations are used:
    <span lang="de">
    <ul>
    <li>Guten Morgen!</li>
    <li>Guten Tag!</li>
    <li>Guten Abend!</li>
    </ul>
    </span>
    

    That's invalid HTML, regardless of how you look at it. And if I'm not heavily mistaken, the HTML Corrector filter will strip or destroy the markup.

hanno’s picture

1. Is filtered html not mainly for semantic markup to allow more meaning in the text (links, citations, lists, definitions) and not for styling?
2. good point. Help text doesn't divide inline and block level tags and that is true for all phrase tags (strong, em, cite, dfn, ...):

<strong>
<ul>
<li>Guten Morgen!</li>
<li>Guten Tag!</li>
<li>Guten Abend!</li>
</ul>
</strong>

Is invalid html as well.

EDIT: maybe there is an usability issue on the text formats? At the moment the list of tags below the input box doesn't mean anything for the majority of users.

xjm’s picture

I'd certainly agree that my end users pretty much never read the freaking filter tips, but that's another issue. :) I'm not sure users inputting invalid markup is really part of this issue either. That's going to happen no matter what we do.

Also, remember that we are just talking about a default value. It is very easy to add <span> to the allowed tags. I don't know much about the WCAG and what Drupal is expected to do out of the box, but I think that's the question here. Whether or not adding <span> as a default tag would enhance our compliance with: http://www.w3.org/TR/ATAG20/#principle_b2, or whether it's not relevant and it should be up to site builders to add the tag if they should use it.

Everett Zufelt’s picture

I am on the fence on this issue.

On the one hand it is good to be more ATAG compliant out of the box. That being said lang="fr" can be used on any element currently allowed by the filter.

On the other hand, being technically compliant, but so doing in a way that means that we really haven't added any usability isn't really that beneficial. If almost nobody knows how to properly use <span lang="fr">bonjour</span> properly have we really added any value to the product?

Bojhan’s picture

I can somewhat confirm what xjm is saying that users hardly/don't notice the filter tips. It is likely we will use a different design for this in D8.

I share Everett his concerns whether we are truly adding value, if it is unlikely users will notice and actually use it.

droplet’s picture

@#19,

alright, if it get into default tags, I would suggest change tips and examples. lang="fr" is allowed & valid in every tags ?

+++ b/core/modules/filter/filter.moduleundefined
@@ -1275,6 +1275,7 @@ function _filter_html_tips($filter, $format, $long = FALSE) {
+    'span' => array(t('Group part of a text (i.e. for language)'), t('<span lang="fr">C\'est la vie</span>')),

18 days to next Drupal core point release.

mgifford’s picture

Nice addition @droplet

mgifford’s picture

Status: Needs work » Needs review

#11: 1322906-11.patch queued for re-testing.

mgifford’s picture

Issue tags: +i18n, +language of parts

tagging

hanno’s picture

Status: Needs review » Closed (fixed)
Issue tags: -i18n, -language of parts

Closing this issue as the span in the restricted html input format is in core now for the standard wysiwyg, since the patch in #1911884: Enable CKEditor in the Standard install profile
See also release note: http://drupal.org/node/1941642 :

"Limit HTML tags (filter_html): a, em, strong, cite, blockquote, code, ul, ol, li, dl, dt, dd, h4, h5, h6, p, span, img — MODIFIED: span and img tags now also allowed"

pancho’s picture

Title: allow span tag by default for language changes? » Enable authors to tag language changes
Component: filter.module » editor.module
Status: Closed (fixed) » Active

Might be interesting though to have a preconfigured WYSIWYG button. That would be a real enabler.

hanno’s picture

A button would be even better. I added an issue for the ckeditor component #1993928: Language of parts: Introduce a language toolbar button but then I saw you altered this issue to the editor. Shall we close this one? Or shall we separate the task to get a button in ckeditor, and the implementation in Drupal?

pancho’s picture

Component: editor.module » filter.module
Status: Active » Fixed

IMHO, we should definitely close and revert this one to its original scope, and followup on the new ticket.

hanno’s picture

Title: Enable authors to tag language changes » Allow span tag by default for language changes?

Great, hope it will get integrated in ckeditor

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mgifford’s picture

@Hanno are you going to open a new ticket & link it to this one?

hanno’s picture

hanno’s picture

Issue summary: View changes

typo

mgifford’s picture