Skip to content

Commit 9f3c338

Browse files
committed
fix(tagify): preserve dropdown.enabled; no reposition while dropdown visible
tagify.js: - Snapshot constructor `settings` in `origSettings` before merging with defaults - When toggling readonly off, restore `settings.dropdown.enabled` from `origSettings` after event rebind - `repositionScopeInput`: return false when `state.dropdown.visible` (alongside existing mix-mode guard). This is required so arrow navigation won't interfere with suggestions dropdown key bindings
1 parent 0adad21 commit 9f3c338

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/tagify.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Tagify.prototype = {
128128
}
129129

130130
var mergedDefaults = extend({}, DEFAULTS, (settings.mode == 'mix' ? mixModeDefaults : {}));
131+
this.origSettings = extend({}, settings);
131132
var _s = this.settings = extend({}, mergedDefaults, settings)
132133

133134
_s.disabled = input.hasAttribute('disabled')
@@ -1070,11 +1071,14 @@ Tagify.prototype = {
10701071
this.settings.userInput = true;
10711072
this.setContentEditable(!toggle)
10721073

1074+
// when readonly is toggled to false, re-bind all events and change back auto-modified settings
10731075
if( !toggle ) {
10741076
// first unbind all events
10751077
this.events.binding.call(this, true)
10761078
// re-bind all events
10771079
this.events.binding.call(this)
1080+
1081+
_s.dropdown.enabled = this.origSettings.dropdown.enabled;
10781082
}
10791083
},
10801084

@@ -1784,7 +1788,7 @@ Tagify.prototype = {
17841788
focus = options.focus !== undefined ? options.focus : !isReset;
17851789

17861790
// mix-mode layout is not “tags + input siblings”; moving the input would corrupt the DOM
1787-
if( _s.mode == 'mix' )
1791+
if( _s.mode == 'mix' || this.state.dropdown.visible )
17881792
return false;
17891793

17901794
if( !input || !scope || parent != scope )

0 commit comments

Comments
 (0)