Skip to content

Catalog Widget causes accessibility issues with duplicate ids #37621

Open
@dmanners

Description

@dmanners

Preconditions and environment

  • Magento version 2.4.5-p3,
  • A home page with the product list catalog widget (in carousel mode) on it with a selection of products with at least one having a special price/discount/tier price setup,
  • We are using cypress-axe to run an accessibility test on the given pages,

Steps to reproduce

  1. Navigate to store home page,
  2. Inspect html and see that the span id="old-price-X-widget-product-carousel" when X is equal to the product id is on the page more than once,

Expected result

Price classes and ids are built in the same way as the product list and as such do not cause any duplicate id issues.

Actual result

Accessibility report contains the following:

Fix any of the following:
  Document has multiple static elements with the same id attribute: old-price-64199-widget-product-carousel"

<span id="old-price-64199-widget-product-carousel" data-price-amount="4.9" data-price-type="finalPrice" class="price-wrapper "><span class="price">4,90&nbsp;€</span></span>

Additional information

We have the following patch in our system to fix this.

diff --git a/vendor/magento/module-catalog-widget/Block/Product/ProductsList.php b/vendor/magento/module-catalog-widget/Block/Product/ProductsList.php
index 7e6693c..f856123 100644
--- a/vendor/magento/module-catalog-widget/Block/Product/ProductsList.php
+++ b/vendor/magento/module-catalog-widget/Block/Product/ProductsList.php
@@ -246,9 +246,6 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
         if (!isset($arguments['zone'])) {
             $arguments['zone'] = $renderZone;
         }
-        $arguments['price_id'] = isset($arguments['price_id'])
-            ? $arguments['price_id']
-            : 'old-price-' . $product->getId() . '-' . $priceType;
         $arguments['include_container'] = isset($arguments['include_container'])
             ? $arguments['include_container']
             : true;

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ProductComponent: WidgetIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions