Virtualization breaks browser Find (Cmd+F) for non-visible operations and schemas
Q&A (please complete the following information)
OS: macOS Browser: Firefox 155 / Chrome [version] Version: [browser version] Method of installation: npm / dist assets [whichever applies] Swagger-UI version: 5.33.0 Swagger/OpenAPI version: OpenAPI 3.x
Content & configuration
Example Swagger/OpenAPI definition:
- A large OpenAPI definition containing enough operations/schemas for the virtualization to take effect.
Describe the bug you're encountering
Since Swagger UI 5.33.0, the newly introduced virtualization for operations and schemas means that only items currently within the viewport are rendered in the DOM. As a result, the browser's native Find feature (Cmd+F on macOS) can no longer find operations or schemas that have not yet been rendered.
For large API definitions, this significantly impacts the ability to quickly navigate the documentation. Before 5.33.0, Cmd+F could search the entire rendered Swagger UI page and immediately locate a matching endpoint, schema, etc. With virtualization enabled, a matching item outside the current viewport is not present in the DOM, so the browser cannot find it.
This is particularly problematic because there does not appear to be an equivalent built-in search/navigation mechanism that can search the complete set of operations and schemas and jump directly to the matching item.
In other words, I guess the virtualization improves rendering performance for large specifications, but it also removes an important existing way of discovering and navigating the documentation.
To reproduce...
- 1 Open Swagger UI 5.33.0 with a sufficiently large OpenAPI definition containing many operations.
- 2 Make sure the target operation is far enough down the page that it is initially outside the viewport.
- 3 Use the browser's native Find feature (Cmd+F on macOS).
- 4 Search with a keyword to the endpoint path. Observe that the browser cannot find the operation.
- 5 Scroll down until the operation is rendered.
- 6 Repeat the same search and observe that the browser can now find it.
Expected behavior
Browser-native Find should remain usable for navigating the complete Swagger UI documentation.
Alternatively, if virtualization intentionally prevents non-visible content from being present in the DOM, Swagger UI should provide an equivalent built-in search/navigation mechanism that searches the complete OpenAPI definition and can navigate directly to the matching operation or schema.
Source: swagger-api/swagger-ui