[beta 4] Remove null attribute value in breadcrumb.

Created on 25 July 2023, over 1 year ago

Problem/Motivation

There is a weird ternary condition in breadcrumb which can set an HTML attribute value as "null":

<a{{ item_attributes.addClass('fr-breadcrumb__link').setAttribute('href', url).setAttribute('aria-current', loop.last ? 'page' : null) }}

Once casted as string, this value will not be valid : https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attribut...

Proposed resolution

Replace by another condition:

{% set item_attributes = loop.last ? item_attributes.setAttribute('aria-current', 'page') : item_attributes %}
<a{{ item_attributes.addClass('fr-breadcrumb__link').setAttribute('href', url) }}>
📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024