-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
Q&A (please complete the following information)
- OS: Windows 11
- Browser: Microsoft Edge
- Version: 143.0.3650.66
- Method of installation: dist assets (plain JS/CSS)
- Swagger-UI version: 5.11.0
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
Example Swagger/OpenAPI definition:
Can be anything
Swagger-UI configuration options:
SwaggerUIBundle({
spec: <swagger-def-json>,
dom_id: '#swagger-ui',
deepLinking: true,
plugins: [
SwaggerUIBundle.plugins.DownloadUrl,
],
onComplete: () => {
const titleElement = document.querySelector('.title');
console.log(titleElement);
}
})Describe the bug you're encountering
When the onComplete callback fires, the DOM content of SwaggerUI is possibly not completely rendered, since querying for known elements returns nothing. This was working fine till v5.10.5.
My implementation adds a couple of buttons on the right end of the title, for copying and downloading the Swagger JSON itself, and these buttons are added to the DOM in the onComplete handler.
To reproduce...
Steps to reproduce the behavior:
As mentioned in the configuration section above, add an onComplete handler which makes a CSS selector query on known elements within SwaggerUI. It will return nothing.
Expected behavior
onComplete signified that the rendering is complete, so querying on elements withing SwaggerUI should work.
Screenshots
Additional context or thoughts
Only thing I could correlate it to was the fact that React 18 support was added with v5.11.0, not sure if that impacted using plain JS/CSS assets.