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

Block Library: Navigation: Remove title attribute from navigation link #19990

merged 1 commit into from Feb 6, 2020


Copy link

aduth commented Jan 31, 2020

Previously: #19735, #17352, #19462 (comment), #19490 (comment), #616

This pull request seeks to remove the title attribute from the Navigation Link block.

For more context, refer to #19735, which includes additional resources for why we should be avoiding the title attribute for links.

Note: To disambiguate, the Navigation Link block will still handle a title from a suggestion in the LinkControl input that it renders. From what I can tell, this is used to assign a default text label of the link. I expect that LinkControl will still continue to offer a title value when the selected link changes. This is consistent from what is reported by the search results endpoint and can be useful for these sorts of scenarios in using e.g. a post title. This is not to be confused with the title HTML attribute, which we should seek to avoid for a anchor tags.

There is not expected to need to be a deprecation here, since the title was used in the dynamic server-side rendering and not in the saved static markup of the block.

Testing Instructions:

Verify that there are no regressions in creating, saving, and previewing a post containing a Navigation and Navigation Link block:

  1. Navigate to Posts > Add New
  2. Insert a Navigation block
  3. Click the "Create empty" button
  4. Add a link
  5. Save and preview the post
  6. Verify that the navigation and navigation link are shown correctly

This comment has been minimized.

Copy link
Member Author

aduth commented Feb 3, 2020

Related: #18061 (comment)

Removing this attribute would cause the LinkControl link previews to no longer show the title associated with a link. However, as I mentioned in the linked comment, this seems like a problem that needs to be addressed generally for all LinkControl, and not be made a responsibility of individual blocks.

Copy link

draganescu left a comment

The code is good and the block is unaffected other than not setting titles on links. LGTM!


This comment has been minimized.

Copy link

draganescu commented Feb 4, 2020

@aduth there are some conflicts here apparently because of the new linting updates in master. Everything else is good to go.

@aduth aduth force-pushed the update/navigation-link-remove-title branch from b2423f9 to 2a187c8 Feb 5, 2020

This comment has been minimized.

Copy link
Member Author

aduth commented Feb 5, 2020

Thanks @draganescu . I've force-pushed a rebased branch, so it should be all clear now.

@aduth aduth merged commit cf1a6d0 into master Feb 6, 2020
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
@aduth aduth deleted the update/navigation-link-remove-title branch Feb 6, 2020
@github-actions github-actions bot added this to the Gutenberg 7.5 milestone Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.