Ticket #1484257: list.diff

File list.diff, 3.6 KB (added by jeblair, 5 years ago)

Patch to list.js and mail/func.inc to work better with screen readers

Line 
1diff -ru a/program/js/list.js b/program/js/list.js
2--- a/program/js/list.js        2008-05-07 16:10:04.000000000 -0700
3+++ b/program/js/list.js        2008-05-07 16:11:09.000000000 -0700
4@@ -4,6 +4,7 @@
5  |                                                                       |
6  | This file is part of the RoundCube Webmail client                     |
7  | Copyright (C) 2006-2008, RoundCube Dev, - Switzerland                 |
8+ | Copyright (C) 2008 Regents of the University of California            |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  +-----------------------------------------------------------------------+
12@@ -368,6 +369,20 @@
13   this.last_selected = id;
14 },
15 
16+/**
17+  * Can be called from a hyperlink in a list to perform the same
18+  * function as a mouse click on the row.  This way, if a screen
19+  * reader activates a link, it performs the same action as a
20+  * mouse click.
21+  */
22+activate: function(e, id)
23+{
24+  var mod_key = rcube_event.get_modifier(e);
25+
26+  if (!mod_key) {
27+    this.select_row(id, mod_key, false);
28+  }
29+},
30 
31 /**
32  * Alias method for select_row
33diff -ru a/program/steps/mail/func.inc b/program/steps/mail/func.inc
34--- a/program/steps/mail/func.inc       2008-05-07 16:10:04.000000000 -0700
35+++ b/program/steps/mail/func.inc       2008-05-07 16:11:09.000000000 -0700
36@@ -6,6 +6,7 @@
37  |                                                                       |
38  | This file is part of the RoundCube Webmail client                     |
39  | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
40+ | Copyright (C) 2008 Regents of the University of California            |
41  | Licensed under the GNU GPL                                            |
42  |                                                                       |
43  | PURPOSE:                                                              |
44@@ -244,7 +245,15 @@
45         $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid';
46         $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset));
47         if (empty($cont)) $cont = Q(rcube_label('nosubject'));
48-        $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont);
49+       $url = Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox)));
50+       if ($CONFIG['preview_pane'])
51+         {
52+           $cont = sprintf('<a href="%s" onclick="rcube_webmail_client.message_list.activate(event, %s); return rcube_event.cancel(event);">%s</a>', $url, $header->uid, $cont);
53+         }
54+       else
55+         {
56+           $cont = sprintf('<a href="%s">%s</a>', $url, $cont);
57+         }
58         }
59       else if ($col=='size')
60         $cont = show_bytes($header->$col);
61@@ -333,7 +342,15 @@
62         $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid';
63         $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset));
64         if (!$cont) $cont = Q(rcube_label('nosubject'));
65-        $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont);
66+       $url = Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox)));
67+       if ($CONFIG['preview_pane'])
68+         {
69+           $cont = sprintf('<a href="%s" onclick="rcube_webmail_client.message_list.activate(event, %s); return rcube_event.cancel(event);">%s</a>', $url, $header->uid, $cont);
70+         }
71+       else
72+         {
73+           $cont = sprintf('<a href="%s">%s</a>', $url, $cont);
74+         }
75         }
76       else if ($col=='size')
77         $cont = show_bytes($header->$col);