Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buttons: Fix the initial white space in nofollow rel #66303

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

vipul0425
Copy link
Contributor

What?

Fixes: #66300

Why?

When the button settings don't specify a rel attribute value and the user clicks on 'Mark as nofollow' in the link's advanced settings, an extra space is added to the rel attribute in the button link.

How?

This PR trims the final value of rel attribute to remove redundant initial space.

Testing Instructions

  1. Add a button block and insert a link
  2. Edit the link and check the mark as nofollow option
  3. View the resulting HTML code via the Code editor
  4. OR inspect the button element via the browser
  5. Notice the link's rel="nofollow" attribute should not have space before the value

Screenshots or screencast

Screen.Recording.2024-10-22.at.12.04.29.PM.mov

Copy link

github-actions bot commented Oct 22, 2024

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: vipul0425 <vipulgupta003@git.wordpress.org>
Co-authored-by: akasunil <sunil25393@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: franzaurus <franz00@git.wordpress.org>

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

@akasunil akasunil added [Type] Bug An existing feature does not function as intended [Block] Buttons Affects the Buttons Block labels Oct 22, 2024
Copy link
Member

@akasunil akasunil left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@Mamaduka
Copy link
Member

The getUpdatedLinkAttributes method has unit tests. Let's add coverage for this case as well.

@Mamaduka Mamaduka changed the title fix: The initial white space in nofollow rel in button. Buttons: Fix the initial white space in nofollow rel Oct 23, 2024
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.

Thank you, @vipul0425 and @akasunil!

@akasunil akasunil merged commit b152b21 into WordPress:trunk Oct 23, 2024
64 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.6 milestone Oct 23, 2024
karthick-murugan pushed a commit to karthick-murugan/gutenberg that referenced this pull request Nov 13, 2024
* fix: the initial white space in noFollow rel.

* Added unit test to cover nofollow attribute without spacing

---------

Co-authored-by: vipul0425 <vipulgupta003@git.wordpress.org>
Co-authored-by: akasunil <sunil25393@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: franzaurus <franz00@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nofollow option in a button link block adds unnecessary space before the attribute
3 participants