Fix keyboard navigation (tabindex) on attachments list in compose

pull/6759/merge
Aleksander Machniak 5 years ago
parent 1e365b4d9d
commit d39d49b7a6

@ -1227,6 +1227,7 @@ function rcmail_compose_attachment_list($attrib)
'href' => "#load", 'href' => "#load",
'class' => 'filename', 'class' => 'filename',
'onclick' => sprintf("return %s.command('load-attachment','rcmfile%s', this, event)", rcmail_output::JS_OBJECT_NAME, $id), 'onclick' => sprintf("return %s.command('load-attachment','rcmfile%s', this, event)", rcmail_output::JS_OBJECT_NAME, $id),
'tabindex' => $attrib['tabindex'] ?: '0',
), $link_content); ), $link_content);
$delete_link = html::a(array( $delete_link = html::a(array(

@ -827,6 +827,7 @@ html.touch {
&:extend(.font-icon-class); &:extend(.font-icon-class);
.font-icon-regular(@fa-var-file); .font-icon-regular(@fa-var-file);
height: @attachmentslist-item-height; height: @attachmentslist-item-height;
margin: 0;
} }
&.txt:before, &.txt:before,
@ -943,6 +944,7 @@ html.touch {
a.filename { a.filename {
display: flex; display: flex;
overflow: hidden; overflow: hidden;
padding: 0 .2em;
} }
.attachment-name { .attachment-name {
@ -952,7 +954,7 @@ html.touch {
.attachment-size { .attachment-size {
color: @color-list-secondary; color: @color-list-secondary;
padding: 0 .25em; padding-left: .25em;
} }
} }
} }

@ -2855,20 +2855,27 @@ function rcube_elastic_ui()
{ {
item = $(item); item = $(item);
if (!item.is('.no-menu') && !item.children('.drop').length) { if (!item.is('.no-menu') && !item.children('.dropdown').length) {
var label = rcmail.gettext('options'); var label = rcmail.gettext('options'),
var button = $('<a>') fname = item.find('a.filename');
.attr({
var button = $('<a>').attr({
href: '#', href: '#',
tabindex: 0, tabindex: fname.attr('tabindex') || 0,
title: label, title: label,
'class': 'button icon dropdown skip-content' 'class': 'button icon dropdown skip-content'
}) })
.on('click', function(e) { .on('click', function(e) {
return attachmentmenu($('#attachmentmenu'), button, e); return attachmentmenu($('#attachmentmenu'), button, e);
}) })
.append($('<span>').attr('class', 'inner').text(label)) .append($('<span>').attr('class', 'inner').text(label));
.appendTo(item);
if (fname.length) {
button.insertAfter(fname);
}
else {
button.appendTo(item);
}
} }
}; };

@ -907,17 +907,26 @@ function rcube_mail_ui()
{ {
item = $(item); item = $(item);
if (!item.children('.drop').length) if (!item.children('.drop').length) {
var label = rcmail.gettext('options'); var label = rcmail.gettext('options'),
item.append($('<a>') fname = item.find('a.filename'),
.attr({'class': 'drop skip-content', tabindex: 0, 'aria-haspopup': true, title: label}) tabindex = fname.attr('tabindex') || 0;
var button = $('<a>')
.attr({'class': 'drop skip-content', tabindex: tabindex, 'aria-haspopup': true, title: label})
.text(label) .text(label)
.on('click keypress', function(e) { .on('click keypress', function(e) {
if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) {
attachmentmenu(this, e); attachmentmenu(this, e);
return false; return false;
} }
})); });
if (fname.length)
button.insertAfter(fname);
else
button.appendTo(item);
}
} }
/** /**

Loading…
Cancel
Save