Use data attr instead of HTML id

Created on 25 October 2022, over 1 year ago
Updated 18 April 2024, 2 months ago

Problem/Motivation

When paragraph template has the id attribute defined and not only containing the number, eg. 'paragraph--ID', layout paragraphs builder control will not appear. Because it is depending on the id attribute to attach control, which is looking for 'ID' alone.

Steps to reproduce

Add paragraph.html.twig, customize to have a paragraph ID.

...
{% set paragraph_id = 'paragraph--' ~ paragraph.id.value %}
<div{{ attributes.addClass(classes).setAttribute('id', paragraph_id) }}>
...
</div>

Proposed resolution

Use the "data-id" attribute.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇲🇾Malaysia ckng

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024