From 3a58da810d81e85838c09abfd48e80f74f7d490a Mon Sep 17 00:00:00 2001 From: Vehbi Karaagac <42275242+Xapollon430@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:56:10 -0500 Subject: [PATCH] Respect disabled fieldsets during option selection --- cypress/e2e/disabled-fieldset.cy.js | 22 ++++++++++++++++++++++ js/bootstrap-select.js | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 cypress/e2e/disabled-fieldset.cy.js diff --git a/cypress/e2e/disabled-fieldset.cy.js b/cypress/e2e/disabled-fieldset.cy.js new file mode 100644 index 000000000..e4e74e287 --- /dev/null +++ b/cypress/e2e/disabled-fieldset.cy.js @@ -0,0 +1,22 @@ +describe('A select inside a disabled fieldset', () => { + it('preserves the value when the fieldset becomes disabled with the menu open', () => { + cy.visit('/tests/index.html'); + cy.window().then(({ $ }) => { + $('body').append(` +
+ `); + $('#project').selectpicker({ container: 'body' }); + }); + + cy.get('button[data-id="project"]').click(); + cy.get('#project-fieldset').invoke('prop', 'disabled', true); + cy.contains('.bs-container .dropdown-item', 'Beta').click(); + + cy.get('#project').should('have.value', 'Alpha'); + }); +}); diff --git a/js/bootstrap-select.js b/js/bootstrap-select.js index e9e413785..7d0b10882 100644 --- a/js/bootstrap-select.js +++ b/js/bootstrap-select.js @@ -2656,7 +2656,7 @@ }, isDisabled: function () { - return this.$element[0].disabled; + return this.$element.is(':disabled'); }, checkDisabled: function () {