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

regression on 4.22.0 and following: .focus() doesn't work anymore inside an Accordion(open=False) #7895

Closed
1 task done
ngaudemet opened this issue Mar 30, 2024 · 2 comments · Fixed by #7963
Closed
1 task done
Labels
bug Something isn't working Priority High priority issues Regression Bugs did not exist in previous versions of Gradio

Comments

@ngaudemet
Copy link

ngaudemet commented Mar 30, 2024

Describe the bug

Thank you for the tremendous work on Gradio!

I use Accordion(open=False) to hide components (such as a Dropdown and some buttons) and show them only when the user need it.
I then use a .focus event on the Dropdown.
It worked perfectly with gradio 4.21.0 but since 4.22.0, 4.23.0 and 4.24.0, it doesn't work anymore : it is impossible to open the Dropdown when I listen to gr.Dropdown.focus() inside my Accordion (only when this Accordion is initially set to open=False), since the Accordion closes itself automatically

this prevents me from using 4.22.0 and newer versions

and another idea : it would be nice to have an open=True parameter for gr.Dropdown as in Accordions

Thanks a lot!

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as demo:

    with gr.Accordion(open=False):
        zouzou = gr.Dropdown(
            choices=["zouzou", "zouzou2"],
            type="index",
        )

    zouzou.focus(
        fn=lambda x: print(x),
        inputs=[zouzou],
        outputs=[],
        queue=False,
    )

demo.launch()

Screenshot

before I click on the Dropdown
image

and then the Accordion closes itself when I click on the Dropdown, which disappears
image

Logs

No logs

System Info

gradio==4.22.0 (or 4.23.0 or 4.24.0)
Mac Safari or Chrome 
PC Chrome or Edge
iPhone Safari or Chrome

Severity

I can work around it

@ngaudemet ngaudemet added the bug Something isn't working label Mar 30, 2024
@abidlabs abidlabs added Priority High priority issues Regression Bugs did not exist in previous versions of Gradio labels Mar 30, 2024
@C0untFloyd
Copy link

C0untFloyd commented Mar 30, 2024

Also, since 1.24.0 clicking onto a subcontrol inside an open accordion closes it (Firefox but probably others too...)

@ngaudemet
Copy link
Author

ngaudemet commented Apr 3, 2024

I corrected repro code to see the error: open=False needs to be in the gr.Accordion() to see the bug, not in the Blocks() of course

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority High priority issues Regression Bugs did not exist in previous versions of Gradio
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants