From 9ca7aa414fb71404ef3a7cf5181b5068a38899e0 Mon Sep 17 00:00:00 2001 From: Cam Race Date: Tue, 10 Sep 2024 10:41:26 +0100 Subject: [PATCH] cracked the links issue in documentation --- R/data-bad_link_text.R | 5 +++-- R/external_link.R | 22 +++++++++++----------- man/bad_link_text.Rd | 4 ++-- man/external_link.Rd | 23 ++++++++--------------- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/R/data-bad_link_text.R b/R/data-bad_link_text.R index d1faa68..feae0ff 100644 --- a/R/data-bad_link_text.R +++ b/R/data-bad_link_text.R @@ -4,8 +4,9 @@ #' check for in the `external_link()` function. #' #' We've started curating this list so we can create automated checks to help -#' all link text to be as descriptive as possible in line with WCAG 2.2 success -#' criteria 2.4.4: Link Purpose (In Context). +#' all link text to be as descriptive as possible in line with +#' [WCAG 2.2 success criteria 2.4.4: Link Purpose (In Context)]( +#' https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context). #' #' @format ## `bad_link_text` #' A data frame with 48 rows and 1 columns: diff --git a/R/external_link.R b/R/external_link.R index c3661dc..15854bf 100644 --- a/R/external_link.R +++ b/R/external_link.R @@ -10,7 +10,8 @@ #' #' This function automatically adds the following to your link: #' * `target="_blank"` to open in new tab -#' * `rel="noopener noreferrer"` to prevent reverse tabnabbing +#' * `rel="noopener noreferrer"` to prevent [reverse tabnabbing]( +#' https://owasp.org/www-community/attacks/Reverse_Tabnabbing) #' #' By default this function also adds "(opens in new tab)" to your link text #' to warn users of the behaviour. @@ -18,20 +19,19 @@ #' This also adds "This link opens in a new tab" as a visually hidden span #' element within the html outputted to warn non-visual users of the behaviour. #' -#' Related links (aware of the painful irony but couldn't make the -#' documentation work in any other way!)... +#' Related links and guidance: #' -#' Government digital services guidelines on the use of links: -#' https://design-system.service.gov.uk/styles/links/ +#' * [Government digital services guidelines on the use of links]( +#' https://design-system.service.gov.uk/styles/links/) #' -#' Anchor tag html element and its properties: -#' https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a +#' * [Anchor tag html element and its properties]( +#' https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) #' -#' Web Accessibility standards link text behaviour: -#' https://www.w3.org/TR/WCAG20-TECHS/G200.html +#' * [WCAG 2.2 success criteria 2.4.4: Link Purpose (In Context)]( +#' https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context) #' -#' Reverse tabnabbing: -#' https://owasp.org/www-community/attacks/Reverse_Tabnabbing +#' * [Web Accessibility standards link text behaviour]( +#' https://www.w3.org/TR/WCAG20-TECHS/G200.html) #' #' @param href URL that you want the link to point to #' @param link_text Text that will appear describing your link, must be diff --git a/man/bad_link_text.Rd b/man/bad_link_text.Rd index eb538f3..b88e796 100644 --- a/man/bad_link_text.Rd +++ b/man/bad_link_text.Rd @@ -25,7 +25,7 @@ check for in the \code{external_link()} function. } \details{ We've started curating this list so we can create automated checks to help -all link text to be as descriptive as possible in line with WCAG 2.2 success -criteria 2.4.4: Link Purpose (In Context). +all link text to be as descriptive as possible in line with +\href{https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context}{WCAG 2.2 success criteria 2.4.4: Link Purpose (In Context)}. } \keyword{datasets} diff --git a/man/external_link.Rd b/man/external_link.Rd index 514ec79..7d6cd8c 100644 --- a/man/external_link.Rd +++ b/man/external_link.Rd @@ -27,7 +27,7 @@ this we should be careful... This function automatically adds the following to your link: \itemize{ \item \code{target="_blank"} to open in new tab -\item \code{rel="noopener noreferrer"} to prevent reverse tabnabbing +\item \code{rel="noopener noreferrer"} to prevent \href{https://owasp.org/www-community/attacks/Reverse_Tabnabbing}{reverse tabnabbing} } By default this function also adds "(opens in new tab)" to your link text @@ -36,20 +36,13 @@ to warn users of the behaviour. This also adds "This link opens in a new tab" as a visually hidden span element within the html outputted to warn non-visual users of the behaviour. -Related links (aware of the painful irony but couldn't make the -documentation work in any other way!)... - -Government digital services guidelines on the use of links: -https://design-system.service.gov.uk/styles/links/ - -Anchor tag html element and its properties: -https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a - -Web Accessibility standards link text behaviour: -https://www.w3.org/TR/WCAG20-TECHS/G200.html - -Reverse tabnabbing: -https://owasp.org/www-community/attacks/Reverse_Tabnabbing +Related links and guidance: +\itemize{ +\item \href{https://design-system.service.gov.uk/styles/links/}{Government digital services guidelines on the use of links} +\item \href{https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a}{Anchor tag html element and its properties} +\item \href{https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context}{WCAG 2.2 success criteria 2.4.4: Link Purpose (In Context)} +\item \href{https://www.w3.org/TR/WCAG20-TECHS/G200.html}{Web Accessibility standards link text behaviour} +} } \details{ Intentionally basic wrapper for html anchor elements making it easier to