[IMP] web_tree_many2one_clickable: Don't break keyboard navigation

pull/1576/head
Alexandre Díaz 2020-04-14 17:05:09 +02:00
parent 97fbb9de67
commit 80a0cbba19
2 changed files with 21 additions and 15 deletions

View File

@ -1,10 +1,17 @@
td.o_many2one_cell { td.o_many2one_cell {
a { a {
color: $o-main-text-color !important;
&:hover {
color: $o-main-text-color !important;
}
.many2one_clickable {
margin-left: 0.5em; margin-left: 0.5em;
visibility: hidden; visibility: hidden;
} }
}
&:hover a { &:hover a.many2one_clickable {
visibility: visible; visibility: visible;
} }
} }

View File

@ -32,19 +32,18 @@ odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require)
var self = this; var self = this;
if (!this.noOpen && this.value) { if (!this.noOpen && this.value) {
// Replace '<a>' element // Disable 'click' events
this.$el.removeClass('o_form_uri'); this.$el.off('click');
this.$el = $('<span/>', { this.$el.on('click', function (ev) {
html: this.$el.html(), ev.preventDefault();
class: this.$el.attr('class') + ' o_field_text', })
name: this.$el.attr('name'),
});
// Append button // Append button
var $a = $('<a/>', { var $a = $('<a/>', {
href: '#', href: '#',
class: 'o_form_uri btn btn-sm btn-secondary' + class: 'o_form_uri btn btn-sm btn-secondary' +
' fa fa-angle-double-right', ' fa fa-angle-double-right many2one_clickable',
tabindex: '-1',
}).on('click', function (ev) { }).on('click', function (ev) {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();