Skip to content

Commit

Permalink
Improve accessibility for external links
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimjaved12 committed Feb 18, 2025
1 parent b802298 commit 65efd81
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions base-theme/layouts/partials/external_resource_link.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
{{- $hasWarning := default true .has_external_license_warning -}}
{{- $className := printf "%s %s" "external-link" (default "" .class) -}}
{{- $onClick := "" -}}
{{- $ariaLabel := "" -}}
{{- $ariaLabel := printf "%s (opens in a new tab)" $text -}}
{{- if $hasWarning -}}
{{- $className = printf "%s %s" "external-link-warning" $className -}}
{{- $ariaLabel = printf "%s (opens warning dialog)" $text -}}
{{/* Prevents external links from being clicked before corresponding JS is fully loaded. */}}
{{- $onClick = "event.preventDefault()" -}}
{{- else -}}
{{- $ariaLabel = printf "%s (opens in a new tab)" $text -}}
{{- end -}}
{{- if not (in $href "ocw.mit.edu") -}}
{{- partial "link" (dict
Expand Down

0 comments on commit 65efd81

Please sign in to comment.