Skip to content

Commit

Permalink
Fix problem with search field not autofocusing in Redmine 5.0 or lata…
Browse files Browse the repository at this point in the history
…r(jquery3.6.0)
  • Loading branch information
ishikawa999 committed May 12, 2022
1 parent 0a2cde6 commit 66960bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions assets/javascripts/searchable_selectbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ $(document).on('ajax:success', function() {
initAssignToMeLink();
});

// Fix a problem with focus not working in Redmine 5.0 or later.
// issue: https://github.com/select2/select2/issues/5993
$(document).on('select2:open', function() {
document.querySelector('.select2-search__field').focus();
});

// Override addEventListener to get that there is a native event.
EventTarget.prototype._addEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Redmine::Plugin.register :redmine_searchable_selectbox do
name 'Redmine Searchable Selectbox'
description "This plugin changes Redmine's selectbox searchable."
version '0.1.8'
version '0.1.9'

settings default: {'enabled' => 1}, partial: 'settings/searchable_selectbox_settings'
end
Expand Down

0 comments on commit 66960bc

Please sign in to comment.