Commit 36b4043c authored by Daniel Siepmann's avatar Daniel Siepmann Committed by Morton Jonuschat
Browse files

[BUGFIX] TCA Suggest Wizard usable with keyboard

As styling was already there, but just for mouse, and same is true for
selecting results. The keyboard events now trigger the same behaviour.

Change-Id: Ie265f3b5785efc89f7148b8303d9b62c3a5add88
Resolves: #70463
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/47932


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
parent 16c4eb4d
......@@ -43,6 +43,7 @@
padding: 5px 13px 5px 28px;
display: block;
text-decoration: none;
.autocomplete-selected &,
&:hover {
background-color: @autocomplete-suggestion-link-hover-bg;
text-decoration: none;
......@@ -50,4 +51,4 @@
}
.autocomplete-info {
padding: 5px 15px;
}
\ No newline at end of file
}
......@@ -7120,6 +7120,7 @@ button.close {
display: block;
text-decoration: none;
}
.autocomplete-selected .autocomplete-suggestion-link,
.autocomplete-suggestion-link:hover {
background-color: #fafafa;
text-decoration: none;
......
......@@ -31,6 +31,21 @@ define(['jquery', 'jquery/autocomplete'], function ($) {
'uid': uid,
'pid': pid,
'newRecordRow': newRecordRow
},
insertValue = function(element) {
var insertData = '';
if ($searchField.data('fieldtype') === 'select') {
insertData = $(element).data('uid');
} else {
insertData = $(element).data('table') + '_' + $(element).data('uid');
}
var formEl = $searchField.data('fieldname');
var labelEl = $('<div>').text($(element).data('label'));
var label = labelEl.text();
var title = labelEl.find('span').attr('title') || label;
setFormValueFromBrowseWin(formEl, insertData, label, title);
TBE_EDITOR.fieldChanged(table, uid, field, formEl);
};
$searchField.autocomplete({
......@@ -78,25 +93,16 @@ define(['jquery', 'jquery/autocomplete'], function ($) {
},
onHide: function() {
$containerElement.removeClass('open');
},
onSelect: function() {
insertValue($containerElement.find('.autocomplete-selected a')[0]);
}
});
// set up the events
$containerElement.on('click', '.autocomplete-suggestion-link', function(evt) {
evt.preventDefault();
var insertData = '';
if ($searchField.data('fieldtype') == 'select') {
insertData = $(this).data('uid');
} else {
insertData = $(this).data('table') + '_' + $(this).data('uid');
}
var formEl = $searchField.data('fieldname');
var labelEl = $('<div>').html($(this).data('label'));
var label = labelEl.text();
var title = labelEl.find('span').attr('title') || label;
setFormValueFromBrowseWin(formEl, insertData, label, title);
TBE_EDITOR.fieldChanged(table, uid, field, formEl);
insertValue(this);
});
};
......
......@@ -7111,6 +7111,7 @@ button.close {
display: block;
text-decoration: none;
}
.autocomplete-selected .autocomplete-suggestion-link,
.autocomplete-suggestion-link:hover {
background-color: #fafafa;
text-decoration: none;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment