From 2c57d3a690fcd6d974f472422f1324cc7be05d3b Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 16 Apr 2020 04:58:57 +0200 Subject: [PATCH] fix disabling select boxes if addItems false, document corrects scopes in interface --- src/scripts/choices.ts | 7 ++++--- src/scripts/interfaces/options.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scripts/choices.ts b/src/scripts/choices.ts index fcccbff..e4883c4 100644 --- a/src/scripts/choices.ts +++ b/src/scripts/choices.ts @@ -347,9 +347,10 @@ class Choices implements Choices { this._render(); this._addEventListeners(); - const shouldDisable = - !this.config.addItems || - this.passedElement.element.hasAttribute('disabled'); + let shouldDisable = this.passedElement.element.hasAttribute('disabled'); + if (this._isTextElement) { + shouldDisable = shouldDisable || !this.config.addItems; + } if (shouldDisable) { this.disable(); diff --git a/src/scripts/interfaces/options.ts b/src/scripts/interfaces/options.ts index 4a4e22f..2ebc948 100644 --- a/src/scripts/interfaces/options.ts +++ b/src/scripts/interfaces/options.ts @@ -105,7 +105,7 @@ export interface Options { /** * Whether a user can add items. * - * **Input types affected:** text + * **Input types affected:** text, select, select-multiple * * @default true */