Home > widget-integration > FilterHandler > handleCloseQuickAddToCart
FilterHandler.handleCloseQuickAddToCart property
Handles closing the quick add to cart popup.
Hides the quick add to cart option selection popup and returns focus to the select option button for accessibility. Override this method to customize close behavior or add cleanup logic when the popup closes.
Signature:
handleCloseQuickAddToCart: (target: any) => void;
Example
Extend to track popup closure for analytics:
window.boostWidgetIntegration.extend('FilterHandler', (FilterHandler) => {
return class CustomFilterHandler extends FilterHandler {
handleCloseQuickAddToCart = (target) => {
// Track popup closure
const productItem = target.closest('.boost-sd__product-item');
const productId = productItem?.getAttribute('data-product-id');
analytics.track('quick_add_closed', { product_id: productId });
// Call parent implementation
const popupSelection = target.closest('.boost-sd__popup-select-option');
popupSelection.style.display = 'none';
target.closest('.boost-sd__product-item')
.querySelector('.boost-sd__button--select-option')
.focus();
};
};
});