• I was asked to diagnose a link problem on this website where the generated aria-label was closing the <a> tag with an angle bracket in the text.

    This is the generated html from the paragraph block editor:
    <a rel="noreferrer noopener" aria-label="test >> (opens in a new tab)” href=”https://balfronactiveplacesmap.commonplace.is/” target=”_blank”>test >></a>

    Surely the aria-label should be encoding any special characters to prevent closing the tag etc?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes, the >> should be converted to html entities. We typically use esc_attr() to do this in WP PHP. Where is the aria-label coming from? The paragraph block cannot be expected to escape extra attributes imported from elsewhere.

    Thread Starter webreturn

    (@webreturn)

    This aria-label is being added to the link automatically by the paragraph block. There does not seem to be a way of configuring it to not set an aria-label, and the only workaround I have is to edit the html. I have since seen it also reported here: https://github.com/WordPress/gutenberg/issues/12683

    Moderator bcworkz

    (@bcworkz)

    I see now. I didn’t at first get it was due to the open in new tab option. Editing HTML afterwards does seem to be the only work around. Even adding the HTML entity in the link text before using the link button doesn’t help. It gets converted back to the problem character in the aria label!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘aria label in link problem’ is closed to new replies.