Skip to content

activateSystemCursor should set the cursor on all views #140226

Closed

Description

@mdebbar

At least on the web, the cursor can be set at whatever scope we choose (e.g. entire window, flutter view element, etc). So in order for us to correctly scope the cursor, we would need the viewId information within the activateSystemCursor message.

At the moment, we are always setting the cursor property on the body element. It would be better to set the cursor property on all the <flutter-view> elements instead, for a few reasons:

  1. Avoid polluting the cursor of other parts of the page that don't belong to Flutter.
  2. Fix the mouse cursor when the Flutter View is moved to a PiP window (see comments below).

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: mouseIssues related to using a mouse or mouse support
    a: multi windowIssues related to multi window support
    on Dec 15, 2023
  2. goderbauer commented on Dec 19, 2023

    @goderbauer
    Member

    cc @dkwingsmt

    I suspect that this is going to be difficult because as far as I remember the mouse system doesn't associate the cursor with a view. It sees the cursor as "global".

  3. added
    P2Important issues not at the top of the work list
    on Dec 19, 2023
  4. dkwingsmt commented on Dec 19, 2023

    @dkwingsmt
    Contributor

    Yeah. Normally such cursor changes are associated with widgets, which can be tracked down to a view. However, the cursor API itself is not built with this layer in mind, which allows arbitrary cursor changes unassociated with views. Requiring a view ID in activateSystemCursor might sound confusing.

    Can we just set all views to use this cursor? It might impact the performance but I think the browser must have some kind of optimization.

    Another way is to have the Web manually track the enter/leave events for the view that the cursor is currently in.

  5. holzgeist commented on Nov 26, 2025

    @holzgeist
    Contributor

    I'm not sure if this is related to this issue or if I should open up a new one. But it sounds like a solution to this problem would solve mine too:

    I'm currently working on a project using the Document Picture-in-Picture API. Similar to the example on MDN, I just move the element containing the view into the pip window.
    In browser DevTools, it looks like the mouse cursor changes are still sent to the body element in the originating window, not to the pip window.

  6. dkwingsmt commented on Dec 1, 2025

    @dkwingsmt
    Contributor

    Now that I look at it, I think we should apply the cursor to all Flutter views, and therefore activateSystemCursor should not include a view ID. As far as I see, Web is designed to support only a single mouse cursor.

    As for @holzgeist 's issue, I'm not familiar with the PIP feature, but your description sounds like a bug to me. We should apply the cursor to the correct div. I'll appreciate it if you can file an issue with a complete reproduction. Thank you.

  7. holzgeist commented on Dec 2, 2025

    @holzgeist
    Contributor

    @dkwingsmt I found a workaround (Listen for cursor changes on the main window with a MutationObserver and copy the style to the pip window), but I'll try to generate a minimal example

  8. mdebbar commented on Dec 2, 2025

    @mdebbar
    ContributorAuthor

    Can we just set all views to use this cursor? It might impact the performance but I think the browser must have some kind of optimization.

    That should work. Unless you have hundreds of views, I think the performance impact will be negligible.

    Another way is to have the Web manually track the enter/leave events for the view that the cursor is currently in.

    That's what the browser does for us for free. We just need to set the cursor property on all the appropriate elements.

    I'm currently working on a project using the Document Picture-in-Picture API. Similar to the example on MDN, I just move the element containing the view into the pip window.
    In browser DevTools, it looks like the mouse cursor changes are still sent to the body element in the originating window, not to the pip window.

    Hmm I'm not familiar with pip, but it sounds like the CSS cursor property in the pip window is not inherited from the body.

    As far as I see, Web is designed to support only a single mouse cursor.

    It's true that there's only one mouse cursor active at a time. But the app can specify multiple cursors on different elements, and let the browser switch cursors depending on where the mouse is.

  9. changed the title [-]`activateSystemCursor` should include a view ID[/-] [+]`activateSystemCursor` should set the cursor on all views[/+] on Dec 2, 2025
  10. added a commit that references this issue on Apr 15, 2026
    cc8b50b
  11. added a commit that references this issue on May 22, 2026
    c62a55e
  12. added a commit that references this issue on Jun 24, 2026
    9f7965e
  13. added a commit that references this issue on Jul 31, 2026
    5d36901
  14. added a commit that references this issue on Aug 13, 2026
    56e399a
  15. github-actions commented on Aug 27, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: mouseIssues related to using a mouse or mouse supporta: multi windowIssues related to multi window supportframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions