Skip to content

[Bug]: On interactive query builder page, the "Endpoint" input loses focus with every input #2409

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

Closed
ankit7201 opened this issue Mar 3, 2025 · 4 comments
Assignees

Comments

@ankit7201
Copy link
Contributor

ankit7201 commented Mar 3, 2025

Link to the documentation page or resource

https://docs.strapi.io/dev-docs/api/rest/interactive-query-builder

Describe the bug

On interactive query builder page, the "Endpoint" input loses focuses with every input if the "Endpoint Query Parameters" was in focus previously.

To reproduce bug:

  1. Open https://docs.strapi.io/dev-docs/api/rest/interactive-query-builder
  2. Select the "Endpoint Query Parameters" input area and make some valid changes inside it
  3. Now select the "Endpoint" input and enter some value inside it.

After Step 3, you will notice that after each key press, the input area is losing focus.

Additional context

Did a little bit of digging and it seems like this is due some issue with use editable hook used inside LiveEditor. (Link)

No response

Suggested improvements or fixes

I think we can add the disabled param to the LiveEditor when it is not in focus to prevent the focus going back to LiveEditor.

Related issue(s)/PR(s)

No response

@ankit7201 ankit7201 changed the title [Bug]: On interactive query builder page, the "Endpoint" input loses focuses with every input [Bug]: On interactive query builder page, the "Endpoint" input loses focus with every input Mar 3, 2025
@ankit7201
Copy link
Contributor Author

Hi @pwizla
Would you be open to me taking this on?

@pwizla
Copy link
Collaborator

pwizla commented Mar 10, 2025

Thank you for reporting it, @ankit7201.
I could reproduce the bug last week, but haven't had time to dig deeper and/or go back to you.

I would love it if you could create a pull request, indeed 🙏
Ping me if you need any help with contributing to the repo.

Please target the next branch because we are in the middle of a significant rewrite/reorganization of our documentation that is due out very soon. Once your PR is merged into next, I will backport it to main

@ankit7201
Copy link
Contributor Author

Hi @pwizla
You can check the PR here: #2423

I have wrapped the LiveEditor in a div and using blur and click events on it to figure out if the editor needs to be disabled or not (Unfortunately, LiveEditor does not directly support these events so it needs to be wrapped inside another div for this to work)

pwizla added a commit that referenced this issue Mar 10, 2025
…Closes #2409 (#2423)

* Added disabled option for LiveEditor so that it does not steal focus from endpoint textbox after every character input

* Removed useRef usage for div wrapper for LiveEditor

---------

Co-authored-by: Pierre Wizla <[email protected]>
@pwizla
Copy link
Collaborator

pwizla commented Mar 10, 2025

Closing as I've just merged your PR.
Thank you very much for your help, we at Strapi and the community appreciate it a lot <3

@pwizla pwizla closed this as completed Mar 10, 2025
@pwizla pwizla self-assigned this Mar 10, 2025
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

No branches or pull requests

2 participants