User:SMcCandlish/sandbox21
Linking must be done in particular ways
[edit]The tooltip text must be plain text, no links or other markup
[edit]Do not link, or use any other wikimarkup or HTML markup, in the meaning (popup tooltip) – only plain text.
The mouse-over tooltip for the meaning text is created by a title=
attribute inside an <abbr>
(or, for {{tooltip}}
, <span>
) HTML element's opening tag, so it cannot itself contain any HTML (or markup that resolves to HTML when rendered). This includes simple things like ''italics''
.
Linking in the term
[edit]The "term" (abbreviation in {{abbr}}
, or other inline material in {{tooltip}}
) can be linked, but this needs to be done one of three ways:
- Link around the template:
- code:
[[United Nations|{{abbr|UN|United Nations}}]]
- result: UN
- code:
[[WP:COI|{{tooltip|conflict of interest|in the Wikipedia-specific sense}}]]
- result: conflict of interest
- code:
Linking inside the template will often not have the intended result:
This was not advised because of a Chrome bug, but it is long since fixed. However, there is a still a problem: the link automatically has a title
supplied by MediaWiki (the page name), and this in most browsers will override the tooltip title
of the surrounding span. So, the intended tooltip will actually only be available to:
- screen readers
- in any graphical browser case in which a link is included but is not the entire term content, in which case the intended tooltip will be available when focus is over the span but is not over the part that is a link.
- in a graphical browser that doesn't treat link
title
s as tooltip but only as something to show in some other interface element such as the window footer (and here it will not matter if the entire term content is a link or not).
To wiki-link the abbreviation being marked up by this template, wrap the template in the link, not vice-versa, or the meaning will not appear in some browsers, including Chrome.
For this reason, the template instructions to prefer wrapping the template in the link should be retained, along with addition of the new three-parameter version ({{tooltip|linkTarget|termText|tooltipText}}
).
TESTING:
conflict of interestTooltip in the specific sense employed in Wikipedia policy
Current template output:
Output, weird:
<a href="/wiki/Wikipedia:COI" class="mw-redirect" title="Wikipedia:COI">conflict of interest</a><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r993651011"/> [Tooltip: in the specific sense employed in Wikipedia policy]
Output, working in testcases page:
<a href="/wiki/Wikipedia:COI" class="mw-redirect" title="Wikipedia:COI">conflict of interest</a><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r993651011"/> [Tooltip: in the specific sense employed in Wikipedia policy]
Compatibility | Markup | Renders as |
---|---|---|
Compatible | [[Knockout#Technical knockout|{{abbr|TKO|technical knockout}}]]
|
TKO |
Less compatible | {{abbr|[[Knockout#Technical knockout|TKO]]|technical knockout}}
|
TKO |