Skip to content

feat(config): add disableVirtualization option - #11150

Open
asaugat04 wants to merge 2 commits into
swagger-api:mainfrom
asaugat04:ft/11056-disable-virtualization
Open

asaugat04 wants to merge 2 commits into
swagger-api:mainfrom
asaugat04:ft/11056-disable-virtualization

Conversation

@asaugat04

Copy link
Copy Markdown

Description

This PR does the following:

  • Adds a new disableVirtualization config option (default false).
  • When set to true, the operations list (src/core/components/operations.jsx) and the schemas/models lists (src/core/plugins/oas31/components/models/models.jsx, src/core/plugins/json-schema-5/components/models.jsx) render every item into the DOM instead of only the items currently in the viewport.
  • Documents the new option in docs/usage/configuration.md.

Motivation and Context

Virtualization of the operations and schemas lists keeps large specs performant by only mounting items near the viewport. A side effect is that off-screen items aren't in the DOM, so the browser's native find-in-page (Cmd/Ctrl+F) can't match operations or schemas that haven't been scrolled into view, and there was no supported way to opt out.

This adds an explicit escape hatch: users who need full-DOM rendering (native find, other DOM-dependent tooling, accessibility tooling that walks the DOM) can set disableVirtualization: true and accept the performance trade-off on very large specs.

Fixes #11056

How Has This Been Tested?

  • Added unit tests covering disableVirtualization: true for the operations list and both models components.
  • Ran the full existing unit test suite (npm run test:unit) — no regressions from this change (one pre-existing, unrelated jsdom window.location failure in test/unit/core/utils.js is present on main as well).
  • Ran npm run build:core to confirm the bundle still compiles.
  • Ran eslint/prettier against all changed files with zero warnings.

Screenshots (if appropriate):

N/A — config-only change, no visual difference at the default (false).

Checklist

My PR contains...

  • Features (non-breaking change which adds functionality)

My changes...

  • are not breaking changes.

Documentation

  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

Operations and schemas lists are virtualized above a size threshold
for performance, which keeps off-screen items out of the DOM. This
makes the browser's native find-in-page (Cmd/Ctrl+F) unable to match
items that haven't been scrolled into view.

Add a disableVirtualization config flag so users can opt out of
virtualization and keep full-DOM rendering when native find matters
more than large-spec render performance.

Fixes swagger-api#11056

@saaiilbasnet saaiilbasnet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The implementation looks good.

The disableVirtualization option provides a useful way to disable virtualization for both operations and schemas, allowing users to leverage native browser find-in-page functionality when needed.

The default behavior remains unchanged, and the added unit tests cover both virtualized and non-virtualized rendering paths. The configuration is also clearly documented.

Thanks for the contribution! Approving this PR.

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

Successfully merging this pull request may close these issues.

Virtualization breaks browser Find (Cmd+F) for non-visible operations and schemas

2 participants