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

Generated aria labels for links in block elements can destroy the output #12683

Closed
black-forever opened this issue Dec 7, 2018 · 10 comments
Closed
Labels
[Package] Format library /packages/format-library [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@black-forever
Copy link

black-forever commented Dec 7, 2018

Describe the bug
If in block elements (e.g. Listings) with the characters * ">" * or * "<" * are used in the text, there is a problem with the Aria labels for links.

The entire text of the block is included in the Aria labels. With all the special characters. The special characters are not escaped. This will destroy the output.

To Reproduce
Steps to reproduce the behavior:

  1. Create a block element (e.g. a List) within a post or page
  2. Write several list elements
  3. Use special characters - (for example: "Use a PHP version> 7.2")
  4. Use the Link Function and Edit the Link
  5. Save or Update your post and Preview the post/page.
  6. See the error

Expected behavior
Before copy the content to the Aria label - escape the special characters / html charakters
Example: "&lt" for < | "&gt" for >

Another question: Why is the entire text of the block used for the Aria labels?

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Firefox
  • Version: 63.0.3

Version of Gutenberg

  • WordPress 5.0 with integrated Gutenberg
@swissspidy swissspidy added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Testing Needs further testing to be confirmed. labels Dec 7, 2018
@swissspidy
Copy link
Member

I feel like I saw a similar issue before about this 🤔

@afercia
Copy link
Contributor

afercia commented Dec 8, 2018

Right, in #12154 it was suggested to use a screen-reader-text appended to the link content instead of using aria-label. Unfortunately, that hasn't been addressed yet.

Another question: Why is the entire text of the block used for the Aria labels?

This is a bug, tracked in #12325

@afercia afercia added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention [Package] Format library /packages/format-library and removed Needs Testing Needs further testing to be confirmed. labels Dec 8, 2018
@afercia
Copy link
Contributor

afercia commented Dec 8, 2018

To clarify: insert a link with the text link including a greater than > character:

screenshot 2018-12-08 at 14 15 45

Generated markup (notice the > within the HTML attribute):

screenshot 2018-12-08 at 14 15 49

Layout breakage in the front end, due to invalid markup:

screenshot 2018-12-08 at 14 15 28

@black-forever
Copy link
Author

Thank you for the clarification and the included screens. Due to #12325 the error happens even if the greater than > character is not in the link text itself.

@afercia
Copy link
Contributor

afercia commented Dec 8, 2018

Right! 😞

@Otto42
Copy link
Member

Otto42 commented Dec 16, 2018

Easily reproducible from the description here:
https://wordpress.org/support/topic/a-minor-gutenberg-hyperlink-bug/

@afercia
Copy link
Contributor

afercia commented Jan 27, 2019

Just to note this was reported again on Trac, see https://core.trac.wordpress.org/ticket/46114

@afercia
Copy link
Contributor

afercia commented Feb 24, 2019

Removing the Accessibility label because not a real a11y bug. I guess it should get prioritized though. /Cc @youknowriad

@youknowriad
Copy link
Contributor

This seems fixed by #9963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Format library /packages/format-library [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants