Skip to content

Conversation

@coderGtm
Copy link
Contributor

@coderGtm coderGtm commented Jun 17, 2025

What?

Closes #20208

This PR aims to add more clarity the Link Rel attribute in image URL input by:

  1. Changing the label from 'Link Rel' to 'Link Relation'
  2. Adding a help text with a link to external documentation for more information.

Why?

It was discussed in #20208 to clarify the label and add helper text to clarify what the "link rel" is actually for. It was also proposed to add a link to https://developer.mozilla.org/docs/Web/HTML/Attributes/rel so users can get more information easily.

How?

  1. Changed label to 'Link Relation' for better understanding and readability.
  2. Added a help text with a brief explanation to the attribute.
  3. Used ExternalLink to link external documentation so users can get more info.

Testing Instructions

  1. Open a post or page
  2. Insert an image block or click on an existing image block
  3. In the toolbar, click on Link icon.
  4. Click the down arrow to open more settings
  5. Check that the first field contains 'Link Relation' as label instead of 'Link Rel'
  6. Check that a help text with correct external link is present below the input field.
Screen.Recording.2025-06-17.at.1.26.05.PM.mov

Screenshots

Before After
Screenshot 2025-06-17 at 1 29 21 PM Screenshot 2025-06-17 at 12 38 22 PM

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 17, 2025
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @coderGtm! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@coderGtm coderGtm marked this pull request as ready for review June 17, 2025 08:29
@coderGtm coderGtm requested a review from ellatrix as a code owner June 17, 2025 08:29
@github-actions
Copy link

github-actions bot commented Jun 17, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: coderGtm <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: joedolson <[email protected]>
Co-authored-by: yyppsk <[email protected]>
Co-authored-by: karmatosed <[email protected]>
Co-authored-by: skorasaurus <[email protected]>
Co-authored-by: Soean <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. Needs Copy Review Needs review of user-facing copy (language, phrasing) labels Jun 17, 2025
@coderGtm
Copy link
Contributor Author

Hi @ellatrix

Did you get a chance to look into this PR? I have clarified the purpose and the text as discussed and agreed upon by @Soean, @karmatosed and @skorasaurus in #20208

Is there anything else that I need to do? I am fairly new to contributions here so not sure.

Thanks

@skorasaurus skorasaurus added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility labels Jun 25, 2025
@yyppsk
Copy link

yyppsk commented Jul 2, 2025

Hi @coderGtm,

I’ve tested this PR on on block editor and have put my testing report below.

Machine: macOS Air (M3)
Browsers Tested: Chrome, Safari, Firefox
Environment: WordPress Block Editor (Gutenberg)


Summary

This report confirms that the proposed updates in PR work as intended. The changes enhance the clarity of the "Link Rel" attribute in the image block by updating the label and providing contextual help text with a link to relevant documentation.


Scope of Change

  • The label Link Rel has been changed to Link Relation.
  • A help text has been added below the input field to explain its purpose.
  • A link to MDN documentation on the rel attribute has been included for users seeking more information.

Steps to Reproduce

  1. Open a post or page in the WordPress Block Editor.
  2. Insert a new image block or select an existing image block.
  3. Click the Link icon from the toolbar.
  4. Click the dropdown arrow to reveal additional settings.
  5. Observe the first field in the dropdown.

Expected Results

  • The input label should display as Link Relation.
  • A help text should appear below the field, briefly explaining the attribute.
  • The help text should include a functional hyperlink to external documentation (MDN).

Actual Results

  • Label: Displays as Link Relation correctly in all tested browsers.
  • Help Text: Visible below the input field and clearly explains the use of the attribute.
  • External Link: Redirects correctly to the MDN documentation and opens in a new tab.
  • Cross-Browser Rendering: Verified in Chrome, Safari, and Firefox. No rendering or interaction issues encountered.

Before and After Summary

Context Value
Before Label: Link Rel
No help text
After Label: Link Relation
Help text with MDN link added
Before After
Screenshot 2025-07-02 at 6 44 32 PM Screenshot 2025-07-02 at 7 05 06 PM

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Jul 22, 2025
@karmatosed
Copy link
Member

@Mamaduka looping you in for a review here, to me this is ready to go so taking off the design review. I also approve first the code but I would like a second opinion just to be sure.

@karmatosed karmatosed requested a review from Mamaduka July 22, 2025 19:52
@Mamaduka
Copy link
Member

I think this falls under the "Need Decision" label. I don't have a strong opinion; both labels work for me. Considering it's an advanced setting, users shouldn't just fill it out.

Additionally, the terminology needs to be consistent across the project. The image link control isn't the only place with this field. Examples:

I would hold off making further changes until there's a final decision.

@joedolson
Copy link
Contributor

I think this is a sensible change. The label is pretty unclear as it is, and improving the clarity of that field is valuable.

It is true that relatively few people are likely to use it, but we might as well make it easier for those who do.

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderGtm, thanks for refreshing the branch. It appears that it now contains some unrelated changes.

Additionally, remaining feedback needs to be addressed, and this field needs to be made consistent across the editor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are unrelated to this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@coderGtm
Copy link
Contributor Author

coderGtm commented Sep 4, 2025

@Mamaduka I mistakenly merged another branch into this causing other PR's changes to be added here. I will remove them. Additionally, by remaining feedback do you mean applying this Link Rel changes everywhere in Gutenberg?

@Mamaduka
Copy link
Member

Mamaduka commented Sep 6, 2025

Additionally, by remaining feedback do you mean applying this Link Rel changes everywhere in Gutenberg?

That's right. The similar "Link Rel" fields should be consistent across the app.

@coderGtm
Copy link
Contributor Author

coderGtm commented Sep 8, 2025

@Mamaduka I have made the changes across Gutenberg. Please take a look and let me know if anything else needs to be done. Thanks!

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @coderGtm!

The code changes look good and test well. I've left some notes regarding text copy, based on project guidelines. But I would defer to @karmatosed and @joedolson regarding it.

__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Link rel' ) }
label={ __( 'Link Relation' ) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label={ __( 'Link Relation' ) }
label={ __( 'Link relation' ) }

I think similar labels use sentence case. See: https://github.com/WordPress/gutenberg/blob/trunk/docs/contributors/documentation/copy-guide.md#five-pay-attention-to-capitalization

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
'The link relation attribute defines the relationship between a linked resource and the current document.'

I think we should use standard casing here. This matches casing in the MDN article.

Note: Label and text changes should be the same everywhere.

@coderGtm
Copy link
Contributor Author

coderGtm commented Sep 9, 2025

Thanks for pointing it out @Mamaduka and for taking the time to review and approve the PR. Reading the guidelines you linked, it seems the changes you suggested should be the way to go.

I can still wait for @karmatosed and @joedolson for their nod so we are on the same page.

Copy link
Contributor

@joedolson joedolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one change I'd like to see: to improve the link text for more information.

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid using meaningless link text like "Learn more". Can we instead place the link on the word "link relation attribute"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joedolson. I'd incorporate those changes. Btw, what do you think about the sentence case thing suggested by @Mamaduka earlier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-09-10 at 7 59 36 PM

@Mamaduka @joedolson I have got the link inline with element interpolation. From what I think, now it makes sense to keep the casings as it is since now "Link Relation" is a term that we refer externally directly by clicking on it. I am not sure though and not aware if any guidelines are there for such a case. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have a strong opinion here; I usually follow the text copy guidelines. We could keep casing in the help text, but let's fix it for the label.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the label above the input box? That is capitalized automatically. All labels are like that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Done.

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous request.

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous request.

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous request.

help={
<>
{ __(
'The Link Relation attribute defines the relationship between a linked resource and the current document.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous request.

Comment on lines 244 to 247
'The <linkRel>Link Relation</linkRel> attribute defines the relationship between a linked resource and the current document.'
),
{
linkRel: (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'The <linkRel>Link Relation</linkRel> attribute defines the relationship between a linked resource and the current document.'
),
{
linkRel: (
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
),
{
a: (

Suggestion: We can just use `a as a link placeholder, it's a typical pattern in core, and translators might be more aware of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made these changes @Mamaduka
Thanks!

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-ups, @coderGtm!

The changes look good to me. @joedolson, what do you think?

@joedolson joedolson self-requested a review September 15, 2025 19:58
Copy link
Contributor

@joedolson joedolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little on the fence about the initial capitalization, but I don't think it's important enough to hold this up.

@Mamaduka Mamaduka merged commit 9f492ef into WordPress:trunk Sep 16, 2025
72 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.7 milestone Sep 16, 2025
@t-hamano
Copy link
Contributor

Nit: Personally, I'd be happy if the links were translatable. MDN has many pages localized into several languages. Site users may not be comfortable with English and would prefer to view resources in their own language:

image

Example:

<ExternalLink
href={
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
__(
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
)
}
>
{ __(
'Describe the purpose of the image.'
) }
</ExternalLink>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility Needs Copy Review Needs review of user-facing copy (language, phrasing) [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change link relationship label.

7 participants