Home > widget-integration > CartController > saveFocusElementBeforeCart

CartController.saveFocusElementBeforeCart() method

Save focused element before opening cart modal Protected method - override to customize focus management for specific themes

Signature:

protected saveFocusElementBeforeCart(): void;

Returns:

void

Example

// Custom focus saving for specific theme
protected saveFocusElementBeforeCart(): void {
  super.saveFocusElementBeforeCart();
  // Additional custom focus management
  this.customFocusElement = document.querySelector('.custom-focus');
}