docusaurus-openapi-docs
docusaurus-openapi-docs copied to clipboard
Clicking 'Send API Request' when button is disabled collapses/opens APIDemoPanel
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
- Visit https://docusaurus-openapi.tryingpan.dev/petstore/get-order-by-id
- 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)
- Click 'Send API request'
Screenshots
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
: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 👍
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 👍