Skip to content

Commit

Permalink
fix mod-ctrl
Browse files Browse the repository at this point in the history
  • Loading branch information
aurovrata committed Oct 5, 2021
1 parent 5d7c162 commit edf741a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions hybrid-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Hybrid Dropdown JavaScript plugin insprired from an original idea by Sandrina Pereira (twitter:@a_sandrina_p)
Version: 2.1.0
Version: 2.1.1
Authors: Aurovrata Venet
Twitter: @aurovrata
GitHub: https://github.com/aurovrata/hybrid-html-dropdown
Expand Down Expand Up @@ -761,14 +761,18 @@ class HybridDDError extends Error {
'hybrid-ddi-change':_.change
});
_.listenModClick = false;
_.clearClass('mod-ctrl');
}
break;
}
}
}
//listen for ctrl|shift + click on multiple dropdown.
hsProtype.optionModClick = function(e){
let _ = this, o, i;
let _ = this,
o = e.target.closest('.hybriddd-option'),
i;
if(o) i = o.querySelector('input');
if(e && e.target){ //target only label clicks as they both register on webkit + gekho engines.
if(!e.ctrlKey && !e.shiftKey){ //ctrl keyup does not fire after a ctrl+click.
if(_.listenModClick){
Expand All @@ -785,11 +789,10 @@ class HybridDDError extends Error {
});
_.listenForBulk = false;
}
_.clearClass('mod-ctrl'); //make sure change event will handle this case.
return;
}
o = e.target.closest('.hybriddd-option');
if(o){
i = o.querySelector('input');
if(i){
i.checked = (!i.checked);
i.dispatchEvent(new Event('hybrid-ddi-change', { 'bubbles': true}));
i.classList.add('mod-ctrl');
Expand Down Expand Up @@ -886,7 +889,7 @@ class HybridDDError extends Error {
}
}
}
//toggle values that are hoghlighted.
//toggle values that are highlighted.
hsProtype.toggleValue = function(varr, emit){
let _ = this;
//for now simply add/remove based on first value.
Expand Down

0 comments on commit edf741a

Please sign in to comment.