Skip to content

Conversation

amitraj2203
Copy link
Contributor

@amitraj2203 amitraj2203 commented May 2, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR fixes an issue where the Filter by Price Controls block's slider color is hardcoded to purple in RTL languages, instead of inheriting the current font color as it does in LTR languages.

Closes #54148

Screenshots or screen recordings:

Before After
filter-by-price-rtl-before filter-by-price-rtl-after

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Create a page and add the Product Collection blocks.

  2. Switch to Code editor mode.

  3. Copy and paste the following code to add the Filter by Price Controls block, then return to Visual editor mode.

    Filter by Price Controls Block
    <!-- wp:woocommerce/filter-wrapper {"filterType":"price-filter","heading":"Filter by price"} -->
    <div class="wp-block-woocommerce-filter-wrapper"><!-- wp:heading {"level":3} -->
    <h3 class="wp-block-heading">Filter by price</h3>
    <!-- /wp:heading -->
    
    <!-- wp:woocommerce/price-filter {"heading":"","lock":{"remove":true}} -->
    <div class="wp-block-woocommerce-price-filter is-loading"><span aria-hidden="true" class="wc-block-product-categories__placeholder"></span></div>
    <!-- /wp:woocommerce/price-filter --></div>
    <!-- /wp:woocommerce/filter-wrapper -->
  1. Save the page.
  2. Go to Settings > General > Site Language and change language to a RTL language (ie: Arabic).
  3. Verify on frontend by viewing the page that now the slider color is picking the theme's the font color.
  4. Verify by changing the global color of site from Appearance > Editor > Styles > Color > Palletes
    and choosing any other color

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, @amitraj2203! It's testing as described and it fixes the issue:

Before After
imatge imatge

I just left one comment inline, as I think we can take the opportunity to clean up a couple of CSS lines.

Testing environment
  • WordPress 6.8 local dev environment
  • Plugins: WooCommerce Beta Tester
  • Theme: Twenty Twenty-Five
  • Store creation: April 24th 2025
  • Store size: small

@@ -260,7 +260,7 @@
.rtl {
.wc-block-components-price-slider__range-input-progress {
--track-background: linear-gradient(to left, transparent var(--low), var(--range-color) 0, var(--range-color) var(--high), transparent 0) no-repeat 0 100% / 100% 100%;
--range-color: #{$studio-woocommerce-purple-30};
--range-color: currentColor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can remove this line altogether, as we will inherit the color from here:

And while not related to the issue, we could go a step further and also remove these ones:

.wc-block-components-price-slider__range-input-progress {
--range-color: currentColor;
}

I didn't test yet, but I think they aren't needed either.

Copy link
Contributor Author

@amitraj2203 amitraj2203 May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, @Aljullu.
I've removed those and tested in TT, TT1, and TT5 — it's working fine. However, in the Storefront theme:

  • With an RTL language, both the editor and frontend are still picking up the purple color.
  • For LTR language in the editor, it's also still picking up the purple color, probably due to this rule.

I'm wondering if the scope of this change is limited to only the TT themes, or if we should also update the CSS in the Storefront theme.

Heading Image
Storefront Frontend RTL storefront-frontend-rtl
Storefront Editor RTL storefront-editor-rtl
Storefront Editor LTR storefront-editor-ltr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch with that issue in Storefront, @amitraj2203! In Storefront it's expected that the slider follows the accent color. For example, this is how it looks if I set the color to green in the Customizer:

LTR RTL
imatge imatge

So in this case, the issue is with LTR languages because the accent color is not properly applied. Apparently, we need to increase the specificity of this selector so it 'wins' over the WC core selector. I think adding the tag name would be enough (div.wc-block-components-price-slider__range-input-progress { ... }). Do you want to open a PR for that? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @Aljullu, just to confirm—I'll need to create the issue and PR in this repo, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please! 🙇

@Aljullu
Copy link
Contributor

Aljullu commented May 2, 2025

(Ups, sorry, I approved the PR by mistake, I think we should try to implement the changes I suggested before merging 😅 )

@amitraj2203 amitraj2203 requested a review from Aljullu May 3, 2025 10:13
Copy link
Contributor

github-actions bot commented May 3, 2025

Testing Guidelines

Hi ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks perfect, @amitraj2203! Thanks for your help with another fix! 🙌

@Aljullu Aljullu merged commit be1891e into woocommerce:trunk May 5, 2025
35 checks passed
@github-actions github-actions bot added this to the 9.9.0 milestone May 5, 2025
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: analysis Indicates if the PR requires a PR testing scrub session. plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter by Price slider uses current color in LTR languages but it's purple in RTL languages
2 participants