Short description
From the point of view of usability/accessibility, it is desired that links which open in a new window should announce that at least in <a title>-arg. For more information on this, see e.g. this page (opens in a new window!!!!).
Here is a patch for Moin1.9.0beta3:
1 diff -r 5863854a6ccf formatter/text_html.py
2 --- a/formatter/text_html.py Sat Sep 05 22:28:08 2009 +0200
3 +++ b/formatter/text_html.py Sun Sep 06 00:52:20 2009 +0200
4 @@ -524,6 +524,7 @@
5 param through wikiutil.escape, but text_html formatter's _open
6 will do it again, so this just leads to double escaping now).
7 """
8 + _ = self.request.getText
9 if do_escape is not None:
10 if do_escape:
11 logging.warning("Deprecation warning: MoinMoin.formatter.text_html.url being called with do_escape=1/True parameter, please review caller.")
12 @@ -543,6 +544,14 @@
13 if css:
14 attrs['class'] = css
15
16 + # If link opens in a new window, announce it in 'title'
17 + if 'target' in kw:
18 + if kw['target'] == '_blank':
19 + if 'title' in kw:
20 + kw['title'] = kw['title'] + _(' (Link opens in a new window)')
21 + else:
22 + kw['title'] = _('Link opens in a new window')
23 +
24 markup = self._open('a', attr=attrs, **kw)
25 else:
26 markup = self._close('a')
In the long run, it might be a good idea, to add to the help pages HelpOnEditing also a HelpOnAccessibility page, which explains best-practice in wiki-editing to the users:
- When including an image, please provide a sensible alt tag for it.
- When opening links in new windows with target="_blank", it is always a good idea to add remark on that to the link-text itself (although Moin might add this information to the title-arg in future).
-- OliverSiemoneit 2009-09-05 23:06:35
Discussion
Don't know how to deal with image links. With the patch above, the title-arg in the <a> is there. So it should be ok. However hovering over an image with the mouse always displays the alt of the image only (with the link target as alt-text or the give alt-text as alt-text). Should this be changed? But as far as is could see, changing this is only possible by changing the parser (calling the formatter)??
Test-Cases:
[[FrontPage| FrontPage(Neues Fenster)|target="_blank"]] OK! [[FrontPage|{{attachment:test.png}}|target="_blank"]] Shows "FrontPage" as tool-tip: OK??? [[FrontPage|{{attachment:test.png|Dies ist der Alt-Text }}|target="_blank"]] Shows "Dies ist der Alt-Text" as tool-tip: OK?? [[FrontPage|{{attachment:missing.png}}|target="_blank"]] Shows "Upload attachment" as tool-tip: OK! [[FrontPage|{{attachment:missing.png|Dies ist der Alt-Text }}|target="_blank"]] Shows "Upload attachment" as tool-tip: OK!