Skip to content

Commit 3f04720

Browse files
committed
Fix a problem with focus not working in Redmine 5.0 or later
1 parent 6d659a5 commit 3f04720

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/views/custom_message_settings/_messages.html.erb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ $(document).ready(function() {
1212
setSelect2();
1313
});
1414

15-
let currentSearchKeyword;
15+
// Fix a problem with focus not working in Redmine 5.0 or later.
16+
// issue: https://github.com/select2/select2/issues/5993
17+
$(document).on('select2:open', function() {
18+
document.querySelector('.select2-search__field').focus();
19+
});
20+
21+
var currentSearchKeyword;
1622
$('#key-selector').on('select2:select', function (e) {
1723
var key = e.params.data.id;
1824
var val = e.params.data.text;

assets/stylesheets/custom_messages.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
text-decoration: none;
2727
}
2828

29-
.select2-container--default .select2-results__option span.key {
29+
.select2-container--default .select2-results__option:not(.select2-results__option--highlighted) span.key {
3030
color: gray;
3131
}
3232
.select2-container--default .select2-results__option[aria-disabled=true] {

0 commit comments

Comments
 (0)