Improve microinteractions in experiment table [SCI-7540]

This commit is contained in:
Anton 2023-01-17 13:40:30 +01:00
parent 7eff083bb7
commit f6fe827326
2 changed files with 5 additions and 2 deletions

View file

@ -138,10 +138,13 @@ var inlineEditing = (function() {
.off('click', `${editBlocks} .cancel-button`)
.off('blur', `${editBlocks} textarea, ${editBlocks} input`)
.on('keyup', `${editBlocks}`, function(e) {
var container = $(this);
if (e.keyCode === 27) {
$(`${editBlocks} .cancel-button`).click();
} // Esc
if (e.keyCode === 13 && !container.find('.view-mode').hasClass('hidden')) {
$(editBlocks).click();
}
})
.on('click', editBlocks, function(e) {
// 'A' mean that, if we click on <a></a> element we will not go in edit mode

View file

@ -8,7 +8,7 @@
data-label-after='<%= config[:label_after]&.html_safe %>'
data-placeholder='<%= config[:placeholder] %>'
>
<div class="view-mode" data-placeholder="<%= config[:placeholder] %>"><%= initial_value %></div>
<div class="view-mode" data-placeholder="<%= config[:placeholder] %>" tabindex=0><%= initial_value %></div>
<input placeholder="<%= config[:placeholder] %>" class="hidden input-field" type="text" value="<%= initial_value %>" disabled/>
<div class="button-container">
<span class="save-button"><i class="fas fa-check"></i></span>