swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

a11y: Links must not be embedded in buttons

Open ghost opened this issue 4 months ago • 1 comments

Q&A (please complete the following information)

  • OS: [e.g. macOS] Windows 10
  • Browser: [e.g. chrome, safari] Chrome
  • Version: [e.g. 22] 121
  • Method of installation: [e.g. npm, dist assets] npm
  • Swagger-UI version: [e.g. 3.10.0] Swagger UI React 5.11.3
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0] OpenAPI 3.0

Content & configuration

Basic/default configuration

Describe the bug you're encountering

We use a tool called Sort Site to evaluate conformance with 508 accessibility. It is reporting "The interactive element "a" must not appear as a descendent of the "button" element" as well as "The element "a" must not appear as a descendent of the "button" element." Violates WCAG 2.0 A 4.1.1 https://www.w3.org/TR/2008/REC-WCAG20-20081211/#ensure-compat-parses This is happening on the link with class "nostyle" contained in the span with class "opblock-summary-path" contained within the div with class "opblock-summary-ath-description-wrapper".

To reproduce...

This is occurring on the "path" in the heading of a POST method, but I'm sure other method types too.

Expected behavior

Buttons should not contain links. Either format the link to look like a button or replace the link with plain text.

Screenshots

Here's the code for the rendered page where the link is highlighted. Note that it is contained within a button 4 levels above the . image

Additional context or thoughts

This error happens a LOT. It seems like an easy fix that would solve a bunch of problems.

ghost avatar Feb 12 '24 22:02 ghost

Buttons or links. Definitely not buttons and links! 

Links go somewhere, buttons do something. You just can't do both at the sametime.

mgifford avatar Mar 15 '24 15:03 mgifford