The default behavior for select2 is to block vertical scroll which is fine. With 4.1.0-rc.0 although there is an issue when you re-open modal with select2 closed the vertical scroll is still blocked.
The dropdownParent property on jQuery selector is correctly set to the nearest .modal-content selector but the only way I found to overcome this is to set the scroll block off when in a modal like this:
target.on('select2:open', function (e) {
if (!jQuery(e.target).closest('.modal').length) {
return;
}
const evt = 'scroll.select2';
jQuery(e.target).parents().off(evt);
jQuery(window).off(evt);
});
The issue with this solution is that it works for all modal behavior, not just the close event.
Does anyone has a more solid fix for this? Not a workaround?
jQuery v3.6.0
Bootstrap v5.3.0
The default behavior for select2 is to block vertical scroll which is fine. With 4.1.0-rc.0 although there is an issue when you re-open modal with select2 closed the vertical scroll is still blocked.
The dropdownParent property on jQuery selector is correctly set to the nearest .modal-content selector but the only way I found to overcome this is to set the scroll block off when in a modal like this:
The issue with this solution is that it works for all modal behavior, not just the close event.
Does anyone has a more solid fix for this? Not a workaround?
jQuery v3.6.0
Bootstrap v5.3.0