Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Improve js for Select2 z-index fix
Matthew Kennedy6c54748808f6
diff --git a/backend/app/assets/javascripts/spree/backend/spree-select2.js b/backend/app/assets/javascripts/spree/backend/spree-select2.jsindex 805cbfbb22..3a4e21e39f 100644--- a/backend/app/assets/javascripts/spree/backend/spree-select2.js+++ b/backend/app/assets/javascripts/spree/backend/spree-select2.js@@ -1,23 +1,22 @@document.addEventListener('DOMContentLoaded', function() {- // Custom Select2- // Fix for Select2 v3.x using overlay mask to close any opened Select2 instances- // The overlay mask stops you lowering the z-index of the opend Select2 instance- // This is not needed if upgraded to Select2 v4.x+ // Inititate Select2 on any select element with the class .select2+ $('select.select2').select2({+ allowClear: true+ })++ // BELOW: z-index fix for Select2 v3.x to lower the z-index of an opened Select2.+ // The javascript below is not needed if Spree is updated to use Select2 v4.xwindow.addEventListener('click', function(e) {var select2Drop = document.getElementById('select2-drop')if (select2Drop) {if (select2Drop.contains(e.target)) {- // Click in the Select2 dropdown and do nothing...+ // Clicking inside the Select2 dropdown does nothing...} else {+ // Clicking outside the Select2 dropdown close all open Select2 dropdowns.$('*').select2('close')}}})-- // Inititate Select2 on any select element with the class .select2- $('select.select2').select2({- allowClear: true- })})