Skip to content

Recommend against using the <q> element (or fix its behavior) #10216

Open
@jyasskin

Description

@jyasskin

What problem are you trying to solve?

The <q> element adds language- and nesting-appropriate quotation marks around its contents and provides a place for the markup to include a URL for the source of the quotation. However, these benefits are undermined by UA behavior around <q> elements. In particular:

  1. The quotation marks are not included when text is copied. If you try to copy This sentence includes This is a quotation but stop copying before this, you'll get If you try to copy This sentence includes This is a quotation in Chrome and If you try to copy "This sentence includes "This is a quotation"" (note the extra closing quotes that weren't in the copied text) in Firefox. It would be possible to fix this, but [css-content] Provide a way to generate copyable content w3c/csswg-drafts#8046 hasn't seen movement in the last 1.5 years.
  2. The quotation marks are not included in searches. Search this issue for copy "this and notice the lack of search results. This is confusing when you're a user. This would, again, be possible to fix, but [css-pseudo-4] The browser cannot search the content, is it intentional? w3c/csswg-drafts#6222 also hasn't seen movement. (Firefox can find the quote by itself, but not with any context around it.)
  3. The cite attribute is a usability footgun for authors: it makes authors think they've cited their source, but UAs don't actually show it to users, so users can't see the citation. The spec alludes to this, saying "User agents may allow users to follow such citation links, but they are primarily intended for private use (e.g., by server-side scripts collecting statistics about a site's use of quotations), not for readers.", but this was added in 2012 in e0e4b51 because cite hadn't been adopted by UAs and Hixie didn't want to remove the uses inside HTML, not because Hixie presented evidence people were actually running server-side scripts on it. This seems like an inversion of the priority of constituencies, valuing theoretical purity over users.

To avoid the <q> element, authors can insert their own quotation marks, and add a citation link that users can actually see. This may be slightly more difficult, since the curly quotes that <q> inserts aren't on most keyboards, but many editing tools can infer those, and the benefit to users as described above seems to win over the pain to authors. There probably isn't a significant localization loss in inserting quotation marks manually since the author has to translate the text itself too.

Since <q> is widely used across the web, it's probably impossible for browsers to actually drop support for it; the only change this issue asks for is for the spec to discourage authors from using it. If people are especially enthusiastic, perhaps we could move it to Compat.

What solutions exist today?

Authors can follow "The use of q elements to mark up quotations is entirely optional; using explicit quotation punctuation without q elements is just as correct.", but just saying it's "optional" doesn't focus well enough on the harm to users that comes from using this element.

How would you solve it?

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions