Links must not be embedded in buttons reference:#9570
Content & configuration
Swagger/OpenAPI definition:
# your YAML here
Swagger-UI configuration options:
SwaggerUI({
// your config options here
url: "http://localhost:3000/openapi.json", // Example OpenAPI spec URL
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUI.presets.apis,
SwaggerUI.SwaggerUIStandalonePreset
],
plugins: [
SwaggerUI.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
?yourQueryStringConfig
Is your feature request related to a problem?
I am just feeling annoyed when links are embedded inside buttons in Swagger UI. This goes against HTML accessibility best practices and may cause confusion for users relying on assistive technologies (such as screen readers). Buttons should be used for actions while links should be used for navigation.
Describe the solution you'd like
I would like to see anchor () tags separated from buttons (
Describe alternatives you've considered
An alternative solution could be to allow a configuration flag in Swagger UI settings to control the behavior of buttons and links. However, separating them semantically in the HTML structure seems like the best solution for improving accessibility and keeping the code clean.
Additional context
The issue can be observed in various parts of Swagger UI whether for POST, GET, PUT and DELETE, button or other action buttons that wrap anchor tags Inspecting these elements in the browser's developer tools shows that buttons contain anchor tags inside them, which is not recommended.