Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#59006 closed enhancement (fixed)

No title attribute on oEmbed and REST API <link>s

Reported by: edent Owned by: audrasjb
Priority: normal Milestone: 6.6
Component: Embeds Version: 6.2.2
Severity: normal Keywords: has-screenshots has-patch has-unit-tests needs-testing
Cc: Focuses: accessibility, rest-api

Description

By default, WordPress adds three <link rel="alternate" ... to the <head> of every post.

These are missing the title="..." attribute. This means that some browsers will announce the links as "alternate" with no explanation of their destination - see screenshot attached.

The three links are:

<link rel="alternate" type="application/json" href="https://example.com/wp-json/wp/v2/posts/123" />
<link rel="alternate" type="application/json+oembed" href="https://sexample.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fexample.com%2Fpost%2F" />
<link rel="alternate" type="text/xml+oembed" href="https://example.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fexample.com%2Fpost%2F&#038;format=xml" />

Ideally, these would have title="JSON", title="oEmbed (JSON)", title="oEmbed (XML)" or similar.

Attachments (1)

Screenshot from 2023-08-08 19-05-44.png​ (34.9 KB ) - added by edent 3 years ago.
Lynx browser showing the "alternate" link.

Download all attachments as: .zip

Change History (22)

@edent
3 years ago

Lynx browser showing the "alternate" link.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


3 years ago

#2 @kadamwhite
3 years ago

@TimothyBlynJacobs @rmccue Do you see any reason not to do this? I assume we'd want to translate the title strings

#3 @TimothyBlynJacobs
3 years ago

Yeah seems fine to add. I was unaware lynx was still a thing :)

This ticket was mentioned in ​PR #5080 on ​WordPress/wordpress-develop by ​addisonhardy.


3 years ago
#4

  • Keywords has-patch has-unit-tests added

This PR makes three changes:

Note: The Trac ticket referenced below does not include a consensus discussion around this change. Opening the PR as a proof of concept as part of familiarizing w/ the WP development process as a new contributor at WordCamp US 2023.

Trac ticket: https://core.trac.wordpress.org/ticket/59006

#5 @kadamwhite
3 years ago

@TimothyBlynJacobs Do you think these "title" strings should be translatable?

​@TimothyBlynJacobs commented on ​PR #5080:


3 years ago
#6

Maybe @SergeyBiryukov has some thoughts on localization. My inclination would be that we should still translate it.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


3 years ago

​@joedolson commented on ​PR #5080:


3 years ago
#8

I'm inclined to think these should be translated, although it does feel a little strange. At least in the case of oEmbed (XML), I think that the structure and order of the text could be variable by language, which is enough to justify it, to me.

#9 @joedolson
3 years ago

  • Milestone Awaiting Review → 6.5

I think this is worth doing, even though it probably only applies in a very small number of cases. A little clarity doesn't hurt!

#10 @audrasjb
3 years ago

  • Keywords changes-requested added
  • Owner set to audrasjb
  • Status new → reviewing

Yes these strings should be translatable: even if it's a edge case, as soon as the title is rendered in the user agent, any language change without information about the language of the string would be a compliance issue.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


3 years ago

#12 @swissspidy
3 years ago

  • Milestone 6.5 → 6.6
  • Type defect (bug) → enhancement

This is really more of an enhancement, so moving out of 6.5.

Not sure about the localization, but if we add it, it should use _x() with proper context.

This ticket was mentioned in ​Slack in #core by nhrrob. ​View the logs.


2 years ago

#14 @nhrrob
2 years ago

We have reviewed this ticket in today's bug scrub. It still requires some changes on the PR.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


2 years ago

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


2 years ago

This ticket was mentioned in ​PR #6703 on ​WordPress/wordpress-develop by ​@sabernhardt.


2 years ago
#17

Like #5080, this PR makes three changes:

  • Adds the title attribute to <link rel="alternate"> tags for oEmbed and REST API endpoints
  • Updates the oEmbed PHPUnit tests to reflect the above change
  • Adds the title link-param to REST API Link: headers (verified as supported in ​RFC 8288)

In addition:

  • The link names are translatable, with context.
  • The printf and sprintf functions are on multiple lines for better readability with two placeholders.

Trac 59006

#18 @oglekler
2 years ago

  • Keywords needs-testing added; changes-requested removed

@audrasjb can you take a look, please? It is simple enough to be able to get into 6.6.

#19 @audrasjb
2 years ago

  • Resolution → fixed
  • Status reviewing → closed

In 58286:

Embeds: Add titles to alternate resource links for oEmbed and REST API.

This changeset makes the following changes:

Props edent, kadamwhite, TimothyBlynJacobs, joedolson, swissspidy, sabernhardt.
Fixes #59006.

​addisonhardy commented on ​PR #5080:


2 years ago
#21

Closing as no longer needed due to #6703

Note: See TracTickets for help on using tickets.