docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

Clicking 'Send API Request' when button is disabled collapses/opens APIDemoPanel

Open edd opened this issue 2 years ago • 2 comments

Describe the bug

When browsing generated documentation, if an API Endpoint has required fields that are not filled in and the user clicks 'Send API Request' regardless, the panel will collapse.

Expected behavior

Unsure. Three suggestions:

  • An error should be displayed
  • Focus should move that is required should be highlighted
  • Nothing should happen

Current behavior

The panel collapses

Possible solution

I haven't checked the code, but I imagine the click/tap event is bubbling up to the panel, triggering the collapse

Steps to reproduce

  1. Visit https://docusaurus-openapi.tryingpan.dev/petstore/get-order-by-id
  2. Observe that the API Demo Panel Request field is open, but the Send API Request button is disabled (in this case: a required parameter is not supplied)
  3. Click 'Send API request'

Screenshots

screencast

Context

An end user had missed that a field was required, and assumed that hitting 'Send request' would send the request. Instead, the panel collapsed. No response field appeared - which is seems correct (sending a known-bad request wouldn't help much either).

Your Environment

  • Version used:
  • True in 1.4.0, so I used the demo in the reproduction steps

edd avatar Oct 27 '22 16:10 edd

:tada: Thanks for opening your first issue here! Welcome to the community!

Hi @edd, thanks for bringing this to our attention. We will be working on a fix for this as soon as possible 👍

blindaa121 avatar Oct 27 '22 17:10 blindaa121

Hi @edd, we've just released a new version of the plugin that solves for this issue. Bear in mind, that we are also planning on an ApiDemoPanel form refactor to handle input validations (as this seems to be the ideal solution). Thank you for your patience! Let us know how the update goes 👍

blindaa121 avatar Nov 09 '22 19:11 blindaa121