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",
'class' => 'filename',
'onclick' => sprintf("return %s.command('load-attachment','rcmfile%s', this, event)", rcmail_output::JS_OBJECT_NAME, $id),
'tabindex' => $attrib['tabindex'] ?: '0',
), $link_content);
$delete_link = html::a(array(
@ -1239,8 +1240,8 @@ function rcmail_compose_attachment_list($attrib)
), $button);
$out .= html::tag('li', array(
'id' => 'rcmfile'.$id,
'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']),
'id' => 'rcmfile' . $id,
'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']),
),
$COMPOSE['icon_pos'] == 'left' ? $delete_link.$content_link : $content_link.$delete_link
);

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

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

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

Loading…
Cancel
Save