Skip to content

While typing on normal textbox, the focus get intercepted by multimodaltextbox #11933

@Jaryllan

Description

@Jaryllan

Describe the bug

While having a multimodaltextbox chatbox, I have another normal textbox that is outside of the chatinterface, this normal textbox mainly used for customization. While i was typing on the normal textbox, the focus on the normal textbox switched to multimodaltextbox.

For example, if want to type the word "once" on the normal textbox, after letter 'o' is press, the focus get changed to multimodaltextbox, and the remaining letter 'nce' appear at multimodaltextbox.

From the browser's devtools, I noticed that while i was typing on the normal textbox, the MultimodalTextbox.svelte's "afterUpdate" gets invoked. I believe it is due to this that causes the focus from normal textbox went to multimodaltextbox. It is quite strange for multimodaltextbox event get called while i was typing on a normal textbox.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Reuse the same sample code from https://www.gradio.app/docs/gradio/multimodaltextbox and add a normal textbox outside of the chatbox.

import gradio as gr
import time

# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.


def print_like_dislike(x: gr.LikeData):
    print(x.index, x.value, x.liked)


def add_message(history, message):
    for x in message["files"]:
        history.append({"role": "user", "content": {"path": x}})
    if message["text"] is not None:
        history.append({"role": "user", "content": message["text"]})
    return history, gr.MultimodalTextbox(value=None, interactive=False)


def bot(history: list):
    response = "**That's cool!**"
    history.append({"role": "assistant", "content": ""})
    for character in response:
        history[-1]["content"] += character
        time.sleep(0.05)
        yield history


with gr.Blocks() as demo:
    chatbot = gr.Chatbot(elem_id="chatbot", bubble_full_width=False, type="messages")

    chat_input = gr.MultimodalTextbox(
        interactive=True,
        file_count="multiple",
        placeholder="Enter message or upload file...",
        show_label=False,
        autofocus=True,
        sources=["microphone", "upload"],
    )

    chat_msg = chat_input.submit(
        add_message, [chatbot, chat_input], [chatbot, chat_input]
    )
    bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
    bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])

    chatbot.like(print_like_dislike, None, None, like_user_message=True)

    gr.Textbox("customization", interactive=True)

if __name__ == "__main__":
    demo.launch()

Screenshot

Image

Logs

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.45.0
gradio_client version: 1.13.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 24.1.0
anyio: 4.10.0
audioop-lts is not installed.
brotli: 1.1.0
fastapi: 0.116.1
ffmpy: 0.6.1
gradio-client: 1.13.0
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.34.4
jinja2: 3.1.6
markupsafe: 3.0.2
numpy: 2.3.2
orjson: 3.11.3
packaging: 25.0
pandas: 2.3.2
pillow: 11.3.0
pydantic: 2.11.7
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.12.10
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.47.3
tomlkit: 0.13.3
typer: 0.16.1
typing-extensions: 4.15.0
urllib3: 2.5.0
uvicorn: 0.35.0
mcp is not installed.
pydantic: 2.11.7
authlib is not installed.
itsdangerous is not installed.


gradio_client dependencies in your environment:

fsspec: 2025.7.0
httpx: 0.28.1
huggingface-hub: 0.34.4
packaging: 25.0
typing-extensions: 4.15.0
websockets: 15.0.1

Severity

Blocking usage of gradio

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionBugs did not exist in previous versions of GradiobugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions