Provide accessible text for diff line links

In the current implementation of diffs, as well as in Rapid Diffs, the line links have text displayed in the content of :before pseudo-element take from data-linenumber attribute on the anchor tag. This violates WCAG as the text is not accessible to AT.

current diffs Rapid Diffs
Screenshot_2024-06-10_at_21.15.07 Screenshot_2024-06-10_at_20.56.47

This could be fixed two ways:

  • refactoring the :before solution to include the line number in the actual anchor tag
  • have an enhanced solution for assistive technologies by placing the line numbers inside the anchor tag and hiding for from sighted users BUT providing some extra context. It could be something around Previously line number [line_number] and Now line number [line_number].

Remove 'link-name' from skipped rules in accessibility test case, to verify the change is compliant.

Test file:

Edited by Paulina Sedlak-Jakubowska