-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Format Library: Link aria-label
is assigned wrong text
#12325
Comments
I cannot reproduce this. I get the expected result. Do you have more specific steps to reproduce? |
It does seem to be inconsistent. One thing which seems to be more reliable is if the "Opens in New Tab" option isn't checked until after the link is already applied, and after it has been deselected at least once before.
|
Ah, this is probably because the label is added when there is no selection. I'll have a look. |
Not immediately sure how to fix this problem. We'll probably have to pass an extra property |
Which is probably ok. |
Worth noting, as reported in #12683, special characters used in the link text e.g. In #12154 it was suggested to use a |
I was wondering if there was any temporary fix for this other than going into the code editor and removing the aria label part? |
There's known issues with using There's also another issue with the AODA text accuracy, shouldn't the text be more informative depending on where a link opens to? Example: Opens in new window (internal site) |
@LukaszJaro thanks for your feedback. The article you pointed at omits to mention the "out of order" issue currently happens only with Safari + VoiceOver, and only in some specific cases. It's a user agent bug that should be fixed upstream (cough cough, Apple?). That's not to say other, better, options can't be considered. It's just to clarify the actual impact of a potential use of the I had to google for "AODA" to understand what it is. Please, when using abbreviations, try to expand them on first use or just avoid them 🙂Not everyone is required to know specific countries laws and Acts. That said, I'm a bit surprised this issue is still open. @aduth when you have a chance: how can I help move this issue on? |
@afercia, woops about the AODA(Accessibility for Ontarians with Disabilities Act) applies to Canada - thanks for pointing that out :) I hope a resolution comes soon to this (WP 5.3), each project I do, all of the accessibility experts mention the lack of notification about links opening in new tabs. |
Hey, @afercia and @LukaszJaro. Andrew is on extended leave. Do you know of anyone who could grab this one? |
The current implementation is a bit problematic. Even if we set the correct text when editing a link through an uncollapsed selection (fixing this bug), it's possible that the text in the attribute diverges from the actual text. Imagine the following situation:
<a ... aria-label="some text (opens in a new tab)" ...>some text</a>
<a ... aria-label="some text (opens in a new tab)" ...>some </a>
<a ...>text</a> Notice the incorrect There are many more cases where the text will diverge, because the data is duplicated. Imagine another situation:
<a ... aria-label="some text (opens in a new tab)" ...>some text</a>
<a ... aria-label="some text (opens in a new tab)" ...>some extra text</a> Notice the incorrect In my opinion, we should try to avoid duplicating data and not use the text value in attributes. I believe @afercia mentioned other techniques such as setting a screen reader text. Unfortunately, it’s not so simple to embed additional elements in format elements either, but maybe it’s worth a try. If we do have to use an attribute, perhaps we have to use some sort of placeholder like Thoughts? |
Question: would adding the visually hidden text via PHP on post content save be an option? Much like WordPress adds the Aside: I think those should be improved to also remove the rel attribute when |
Sure, I think a display filter for this would be ideal. It also makes sense for the rest of the text "(opens in a new tab)" as it should probably be dynamically translated. |
There's one more problem with the current approach, which I ran into and documented in #18727 . The language that should be used is not that of the current UI language, but that of the site the article ges published to. In my case, I got German text embedded into the aria-label of a link in an English post, which totally does not make sense. So whatever solution is found for this, it should take into account the actual target language of the site, not the current user. Some of us speak more than one language. ;-) |
I'm considering removing the This whole things seems strange to me. This text should be something for the user agent to add, not the content creator. Ideally it shouldn't be inserted in the source at all. We also can't make it perfect. The user agent will know the language the user has set, which is not necessarily the language of the web page. The user agent will also know if the link opens in a new tab or window. Safari does this well it seems: If we really want to do this, we should append screen reader text in PHP display filters, but we lack context (browser language and tab/window setting). The last place it should be added is to the source content, if we want the label to be consistent. |
Discussed in this in the accessibility meeting on 29 November 2019, and we agree that removing the aria-label is a good temporary solution. Using aria-label creates problems with language consistency, text stability after editing, and doesn't provide accessibility for anybody except screen reader users. We'd like to find a new solution that takes these factors into consideration. Allowing the user agent to provide this would be theoretically great, except for the lack of cross-browser support. One discussed suggestion is having this text inserted in PHP on render or on post save. (Render would make it easier to be consistent with the display language, we think.) |
I opened #20129 (now closed as a duplicate of this) because the @MarcoZehe raised the issue as an author getting the wrong language when creating links in #18727. Add the problem(s) referenced in this issue, and I feel A short-term approach that does not override the accessible name could be a CSS hack in the 2020 theme:
Even when it does not auto-translate, it does not prevent the entire link from translating. |
Introduced in #11063
Previously: #11815 (comment)
Steps to reproduce:
Expected:
Actual:
(the text of the link, with "(opens in new tab)" appended as a suffix)
Observations:
aria-label
appeared to be assigned to the text of the parent paragraphRelevant code:
gutenberg/packages/format-library/src/link/inline.js
Lines 52 to 59 in 563ef41
cc @ryanwelcher @mcsf
The text was updated successfully, but these errors were encountered: