U4-6582 - RTE "Link To File" missing rel="nodeId" attribute

Created by Mark Bowser 01 May 2015, 19:37:01 Updated by Shannon Deminick 23 Jun 2015, 08:56:04

I have reproduced this problem on umbraco v7.1.8 and v7.2.4

When using a RTE, I clicked the "insert/edit link" button and then clicked "Link To File". I am able to successfully link to a file, but the tag is missing the rel="xxx" where xxx is the node id of the media I linked to.

The rel attribute is useful for being able to relate an inserted file back to the media it is related to. I'm working on a package right now that needs to detect media dependencies in Rich Text Editors. One of the ways I am able to accomplish that with the img tags is the rel attribute that references the media node id.

Actual:

<a href="/media/1008/feature_home_greentrees.jpg" title="feature_home_greenTrees.jpg">Trees</a>

Expected:

<a href="/media/1008/feature_home_greentrees.jpg" title="feature_home_greenTrees.jpg" rel="1077">Trees</a>

Comments

Mark Bowser 01 May 2015, 20:29:19

This looks like it was also a problem for the links to content on the tag even without clicking "Link to file"


Bjarne Fyrstenborg 04 May 2015, 07:14:40

Actually I had reported a simular issue http://issues.umbraco.org/issue/U4-5480 where the RTE add rel attribute to tag, but I don't know why/when it originally was added, because rel attribute isn't valid for tags and therefore the page won't be validated successfully according to http://validator.w3.org/

For tag it is however a valid attribute, but it must contains specific values: http://www.w3schools.com/tags/att_a_rel.asp .. so it seems to be a misuse of the rel attribute.

But previously some packages might have used the rel attributes on and tags anyway. It would be much better if it was using custom data-* attributes, e.g. data-rel="1077".

Then the HTML from the editor would return valid markup and packages still could use it. But it should probably be changed in a major version.


Mark Bowser 04 May 2015, 15:39:04

Hmmm. This is a good point. I created a pull request to umbraco already with the rel attribute on the tag. Let me know if I should just throw on a data-rel attribute to both and tags and just leave the rel tag there for and remove the rel tag I just added to .


Shannon Deminick 06 May 2015, 07:22:49

PR: https://github.com/umbraco/Umbraco-CMS/pull/677


Shannon Deminick 23 Jun 2015, 08:55:57

I've merged in the PR and modified. See rev: 40c35e585152ec2a05d890790c6679ee46262cf5

The attribute applied to img and a tags is data-id (data-rel doesn't make much sense). The rel tag is still attached to the img for backwards compat, but it is stripped out from the front-end with the value converter (from a previous version). The tinymce config has been updated to allow the data-id attribute to be rendered. See the additional comments on the PR: https://github.com/umbraco/Umbraco-CMS/pull/719 for more info on the rel attribute for the anchor tag.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category: Extensibility

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.1.8, 7.2.4

Due in version: 7.3.0

Sprint:

Story Points:

Cycle: