Skip to content
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

Operation ids in swagger-ui dashboard are wrapping even if sufficient space is available. #9577

Open
u-arora opened this issue Feb 13, 2024 · 3 comments · May be fixed by #10259
Open

Operation ids in swagger-ui dashboard are wrapping even if sufficient space is available. #9577

u-arora opened this issue Feb 13, 2024 · 3 comments · May be fixed by #10259

Comments

@u-arora
Copy link

u-arora commented Feb 13, 2024

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome
  • Version: 121.0.6167.161
  • Method of installation: npm
  • Swagger-UI version: 5.11.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Describe the bug you're encountering

In swagger ui dashboard, operation ids are wrapped even if there is available space as shown in the screenshot below.

Steps to reproduce the behavior:

  1. Run application locally.
  2. Add the parameter displayOperationId: true in dev-helper-initializer.js under SwaggerUIBundle.
  3. Start the application in dev mode (npm run dev).
  4. We can observe that the operation ids are wrapping even if sufficient space is available.

Expected behavior

Operation ids should not be wrapped if there is enough space.

Screenshots

112
@u-arora
Copy link
Author

u-arora commented Feb 13, 2024

Possible solution

word-break: break-word;

According to me the word-break class was used to prevent text overlapping in mobile view and on removing this class the desktop view looks fine, as the operation ids are not wrapping now if there is enough space available for them. This class should be added to the media query block instead to prevent overlapping in mobile view.

@media (max-width: 768px) {
font-size: 12px;
}

If this looks fine to you I can raise a pull request for this :)

@cremor
Copy link

cremor commented May 14, 2024

While it is true that disabling word-break: break-word; fixes the display issue, this is not the reason why the issue occurs now. Swagger UI version 4.15.5 also set this property and it didn't break the operation id display. Some other change between 4.15.5 and 5.17.9 must have caused this.

@n0spaces
Copy link

This was bugging be so I decided to dive into it.

This was introduced in version 5.9.4 with the class opblock-summary-path-description-wrapper, which wraps the path and description to improve the layout on small screens. This has its width set to 100%, so it tries to take up the entire flex container, causing itself and opblock-summary-operation-id to shrink.

This custom css allows the wrapper take up the remaining space in the container without shrinking anything:

.opblock-summary-path-description-wrapper {
  width: unset !important;
  flex-grow: 1;
}

Image

The operation id still breaks if the description wraps, but honestly that's probably fine. I might try and submit a PR if I can't find a better solution.
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

Successfully merging a pull request may close this issue.

3 participants