Skip to content

Input Changed Event Lifecycle #104

Open

Description

@schreiaj

Potentially out of scope as it is related to the navigator.modelContextTesting - When executeTool updates the UI normal hooks to pick up on changes to input values don't work. change and input events explicitly call out user interactions and MutationObservers won't pick up the change because element.value changes aren't DOM changes. This leaves no common way to watch for MCP driven changes resulting in potential UI desync which could hamper AI/Human hybrid workflows.

This was specifically when using the Declarative API. It may be possible in the imperative API to manually fire onChange or onInput handlers there's not a great way to hook that up in Declarative.

I'm not a browser internals expert - but the most naive approach would be flagging the changes by executeTool as user interaction which would hook into the usual event cycle. Another option could be to add an attribute data-tool-call-updated=[uuid] (or use an appropriate tooluse attribute) which would allow watching for DOM changes using a mutation observer.

Activity

  1. beaufortfrancois commented on Feb 23, 2026

    @beaufortfrancois
    Collaborator

    This bit of Javascript allows you to know when a tool was activated:

    window.addEventListener('toolactivated', ({ toolName }) => {
      console.log(`the tool "${toolName}" execution was activated.`);
      // TODO: Update UI or validate form if needed.
    });
    
    window.addEventListener('toolcancel', ({ toolName }) => {
      console.log(`the tool "${toolName}" execution was cancelled.`);
      // TODO: Let the user know. Update UI.
    });

    Does this help?

  2. schreiaj commented on Feb 23, 2026

    @schreiaj
    Author

    It does, normally I'd like to see it trigger normal input events so it's behavior on behalf of users is treated the same as the user's own behavior. But I also understand these are not user interactions. It's frustrating to have to add extra hooks to reflect updates but pages opt into this functionality anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions