Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix invisible Mini-Cart badge in themes without <body> background #9601

Merged
merged 1 commit into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions assets/js/blocks/mini-cart/utils/set-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ function setStyles() {
const firstMiniCartButton = document.querySelector(
'.wc-block-mini-cart__button'
);
const badgeTextColor = firstMiniCartButton
? getClosestColor( firstMiniCartButton, 'backgroundColor' )
: 'inherit';
const badgeBackgroundColor = firstMiniCartButton
? getClosestColor( firstMiniCartButton, 'color' )
: 'inherit';
const badgeTextColor =
getClosestColor( firstMiniCartButton, 'backgroundColor' ) || '#fff';
const badgeBackgroundColor =
getClosestColor( firstMiniCartButton, 'color' ) || '#000';

// We use :where here to reduce specificity so customized colors and theme
// CSS take priority.
Expand Down