Problem/Motivation
The dom is modified in JS to not only display the icon for awareness of an external link.
Additionally, a span with a body text "(link is external)" is added.
Google even seem to execute JS and then do the indexing.
As a result, our site using extlink has the highest relevancy on the keyword "external".
This is semantically just wrong.
Proposed resolution
Drop the span and just display an icon. Even drop the alt text.
Unsure if switching to an img tag with alt would fix it.
If a client has disabilities, his screen reader should make him aware of the link target. (NOT TRUE, comment #29.)
At least make this an option so the adding the DOM span with the body text can be skipped.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#36 | 2467383-36.patch | 2.04 KB | elachlan |
| |||
#31 | 2467383-31.patch | 2.02 KB | elachlan |
| |||
#23 | 2467383-23.patch | 2.1 KB | elachlan |
| |||
#5 | extlink-aria-label-2467383-5.patch | 1021 bytes | cboyden |
Comments
Comment #1
alexanderschimpf_de CreditAttribution: alexanderschimpf_de as a volunteer commentedOf course this is not a permanent solution, but you could set the variable extlink_label to an empty string, since this module relies on it and will output (link is external) if it is not set.
This can be done by pasting
variable_set("extlink_label", "");
to the end of your template.php and removing again, when it was executed (on page reload).Comment #2
elachlan CreditAttribution: elachlan commentedI'd suggest you dig around in the older issues to understand it better. But I am sure that the span was required for something. It may have been older browsers though, so we might be able to get away with it now.
Comment #3
jim005 CreditAttribution: jim005 at WebSenso commentedJust for your information, we also found this issue on Google Search Google... so we decided to remove this module from our websites :-(
Comment #4
cboyden CreditAttribution: cboyden commentedFor accessibility reasons, any information that is available visually (such as the icon that indicates an external link) also has to be available non-visually. For images, that's usually done with alt text. In this case the extlink icon is a background image, and so the text is added with element-invisible.
Ideally this should be done in a way that's independent of any particular technology. Whether a screenreader will inform the visitor that the link destination is external varies by what the screenreader is capable of and how the end-user has configured it. Also you have to take into account other technologies such as screen magnifiers and alternative input devices, and differences between mobile/touch and desktop/keyboard implementations.
It ought to be possible to satisfy the accessibility requirement using an aria-label on the span instead of invisible text. (It doesn't seem like Google indexes aria-labels now, but who knows if they will eventually.)
Comment #5
cboyden CreditAttribution: cboyden commentedHere's a patch that uses aria-label instead of invisible text.
Comment #7
cboyden CreditAttribution: cboyden commentedNot sure why the admin functionality test is failing, it appears to be a file permissions issue but there are no changes to that test, only to the Javascript that adds the class.
Comment #8
elachlan CreditAttribution: elachlan commentedTests are fixed. Re-roll and we can include it.
Comment #9
elachlan CreditAttribution: elachlan commentedComment #10
elachlan CreditAttribution: elachlan commentedThe disadvantage to this approach is that when css is broken you won't get text showing that the link is external.
Comment #13
elachlan CreditAttribution: elachlan commentedComment #15
cboyden CreditAttribution: cboyden commentedAfter looking into aria-label more closely, it's not going to work on a span all by itself. Assistive technologies are going to ignore aria-labels on elements that aren't either natively-interactive or tagged with an ARIA widget role. I'll see if there's something that can be added to the link markup instead of the span.
Comment #16
elachlan CreditAttribution: elachlan commentedWould the title attribute make sense?
Comment #17
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedNo. The title attribute has very poor accessibility. It's effectively bonus content for sighted mouse users only.
Comment #18
elachlan CreditAttribution: elachlan commentedWell if someone has input on what would be a suitable replace I am eager to hear it.
Comment #19
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedI don't see anything wrong with the original
span.element-invisible
, and I'm skeptical about this bug report. Is there any SEO research and/or advice from Google, Bing, etc., which suggests that indexing "link is external" is actually detrimental for SEO? Even if the search engines think that external is a keyword for the site, does that matter, so long as you have the intended keywords too?SEO represents potential visitors, who may find their way to your website one day. But accessibility is about real visitors who have actually arrived at your website. So I'd prioritize accessibility over SEO.
An approach that you could try is using
aria-describedby
to indicate an external link:In theory this means the OS-level accessibility APIs get a link with an AccessibleName of "Interesting news article" and an AccessibleDescription of "link is external". It will be up to individual screen readers whether to announce the description (e.g. macOS VoiceOver speaks the descriptions after a user-configurable delay).
Comment #20
elachlan CreditAttribution: elachlan commentedThank you so much for your input on this. I have no real knowledge of accessibility standards so I am deferring to other people's knowledge on the subject.
"I'd prioritize accessibility over SEO". I agree.
I think your solution would be workable.
Comment #21
elachlan CreditAttribution: elachlan commentedCan we not just add the aria-label to the anchor tag?
Comment #22
cboyden CreditAttribution: cboyden commented@elachlan that would override the actual text of the link, not add to it.
Comment #23
elachlan CreditAttribution: elachlan commentedComment #24
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commented@elachlan:
No. Using aria-label (or aria-labelledby) will override the link text completely. It's not a supplement to the link text. In the following example, assistive technology would be told that both links have the name "external link". The GitHub/Twitter link text will not be passed to a screen reader at all.
I tried the latest 8.x-1.x branch with various browser/screen reader combinations (i.e. what we have after the commit in comment #14). I wanted to see if @cboyden's concern from #15 was right. I found that in most cases, the link text and external link warning were both announced. This is the markup of a link:
<a href="https://www.drupal.org/project/modules" data-extlink="">modules<span class="ext" aria-label="(link is external)"></span></a>
External link warning announced OK in:
Not working in:
Overall, this is an accessibility regression from what we had before the patch in this issue. Some screen readers don't get the warning which they did before, and the concern in #10 about sighted users when CSS is not applied. The best thing to do for accessibility would be to revert the changes in comments #11-14.
Edit: Sorry, I took a long time to write my comment, an you posted patch #23 while I was testing.
I haven't tested patch #23, to be clear, it was the latest 8.x-1.x branch.
Comment #25
elachlan CreditAttribution: elachlan commentedThe patch basically implemented what you suggested in #19.
Comment #26
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedYes, the patch looks like a correct inplementation of #19. What matters though is whether it improves upon the performance in #24. It will be less reliable I think, because assistive tech isn't always required to convey aria-describedby. Screen readers have verbosity settings which affect it. I'll try it out sometime soon.
Comment #27
spiritcapsule CreditAttribution: spiritcapsule commentedwhat if the
span
is hidden via screen-reader-accessible css (akin to core'selement-invisible
class) instead ofdisplay:none
?$link[icon_placement]('<span class="element-invisible" id="' + $aria_described_by_id + '"> ' + Drupal.settings.extlink.extLabel + '</span>');
Comment #28
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedRE: #27 - well this issue started with a
span.element-invisible
, before this issue was filed - this is going around in circles! The text was available to everyone then, now it's only available to some users, with some assisitive tech.As far as I'm concerned, there's no substance to the SEO claim that started this issue off. Unless there's some actual evidence that the "link is external" actually causes harm for SEO, then I think the changes here should be reverted.
Comment #29
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedAlso, from the issue summary:
This is (a) wishful thinking, and worse (b) it just blames the user for being disabled. It's not the screen reader's job to do that. The screen reader's job is to convey what's on screen, using information provided by the browser. Besides, the whole point of this module adding a visible icon is because sighted users without assistive tech don't know that the link is external.
Comment #30
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedComment #31
elachlan CreditAttribution: elachlan commentedComment #32
elachlan CreditAttribution: elachlan commented@andrewmacpherson, Are you happy with this patch?
Comment #33
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedWhat does it do, does it take us back to the start, before #11?
Comment #34
elachlan CreditAttribution: elachlan commentedCorrect, but also adds a span for when font awesome is used as well.
Comment #35
spiritcapsule CreditAttribution: spiritcapsule commentedSome web accessibility testing tools will flag the
<i>
with a warning. I know it's what FontAwesome suggests, but<span>
works effectively with the fa classes. So my preference would be to use<span>
instead of<i>
.Comment #36
elachlan CreditAttribution: elachlan commentedI changed the i tag to a span.
Comment #37
mgiffordLooks good to me @elachlan
I just looked at the patch though.
Would be good to have someone post a screenshot of this patch being applied
Comment #40
elachlan CreditAttribution: elachlan commentedComment #42
elachlan CreditAttribution: elachlan commentedComment #45
elachlan CreditAttribution: elachlan commentedThanks everyone for their input on this issue.
Comment #46
elachlan CreditAttribution: elachlan commentedI would love everybody's input in #2811293: Accessibility improvements to icons. It might change this again.