Avoid using onclick attribute

Created on 10 August 2016, about 9 years ago
Updated 22 December 2023, almost 2 years ago

Problem/Motivation

When a view mode is managed by DS, the "Add link" setting allow the transforme the entity display in a big clickable area. Currently, DS uses an onclick attribute which is considered as a bad practice. Plus, the onclick attribute is not fired on most mobile browsers so this option becomes unreliable.

Proposed resolution

Use a data attribute and a JS behavior to handle the redirection.

Remaining tasks

Patch, Review, Commit, Backport, Review, Commit

User interface changes

None. (The HTML attribute we change is invisible to the common user)

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡«πŸ‡·France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

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.71.5 2024