Divi Custom Attributes: Targets, Semantics and Behavior

By Interactive OnlinePublished Updated Editorial draft

Quick Answer

Divi Custom Attributes attach valid HTML attributes to a chosen wrapper or supported inner element. Use them for a defined semantic, state or integration need, then verify the rendered target and behavior. Prefer suitable native HTML before adding ARIA. A role, label or data attribute does not create the interaction, event tracking or accessibility support that its name suggests.

Begin by inspecting what Divi already renders. Adding another role or name without that evidence can replace useful semantics or label the wrong element.

Choose an attribute for a specific job

Scroll horizontally to see all columns.

Attribute uses and the additional work they require
Purpose Example type Verify
Reusable styling hook class The stylesheet and correct target
Unique relationship or fragment id Uniqueness across the full document
Extra integration data data-* The script that consumes the value
Control state aria-expanded State changes when the control operates
Name from visible text aria-labelledby The referenced element exists and remains appropriate

The September 30, 2025 publisher guide introduces the system. Current Custom Attributes help documents Target Element, name and value in Advanced → Attributes. Use the actual target choices supported by the installed module.

Keep native semantics and behavior consistent

Use a link for navigation and a suitable button for an action. Adding role=”button” to a generic element does not supply keyboard activation, focus handling or the action itself. The W3C ARIA introduction explains that roles make behavior promises that the implementation must fulfill.

Similarly, aria-expanded must reflect the real open or closed state. A dialog needs the corresponding focus and dismissal behavior. A tooltip role does not create a browser tooltip or make essential instructions available on every device.

Use attributes valid for the target element. For example, rel belongs on a suitable link element rather than an arbitrary wrapper. Do not add every available attribute in an attempt to increase SEO or accessibility.

Treat data hooks as public interface contracts

MDN’s data-attribute reference describes custom data exposed through the DOM. An illustrative data-action="service-contact" can identify a control to a script, but it does not send an analytics event on its own.

Document who uses the hook and whether the event should fire on activation, successful validation or a confirmed response. Keep secrets and personal details out of HTML attributes. Review data handling against the actual approved measurement setup.

Review repeated and shared attributes

Be careful when copying attributes or applying a shared preset. A fixed ID or reference can become invalid when repeated. Inspect the complete page, including shared headers, footers and looped items.

Test the named control and its state after content changes. Our class and ID guide covers insertion and duplicate checks. Our role guide covers meaningful targets, while accessibility services can review the rendered implementation.

Key Takeaways

  • Inspect existing HTML before adding attributes.
  • Choose the actual semantic or integration need.
  • Implement the behavior and state an attribute describes.
  • Check shared references and repeated instances.

Frequently Asked Questions

Does an analytics data attribute send an event?

No. A separate implemented integration must read the hook and send the intended event under the approved measurement rules.

Does role=”button” make a control work by keyboard?

No. Use a suitable native control or implement and test the required behavior.

Can I add an attribute to the module wrapper for any purpose?

The attribute must be valid and meaningful on that target. Some needs belong on an inner link, input, image or control.

Archives