Skip to content

Links must not be embedded in buttons reference:#9570 #10395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Mathias02 opened this issue Mar 31, 2025 · 0 comments
Open

Links must not be embedded in buttons reference:#9570 #10395

Mathias02 opened this issue Mar 31, 2025 · 0 comments

Comments

@Mathias02
Copy link

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 () in the Swagger UI codebase. This would align with best practices in HTML and improve accessibility. Buttons should trigger actions, while links should handle navigation. It would be great if Swagger UI could refactor its implementation to ensure anchor tags and buttons are not nested

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.

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant