Skip to content

Fix: activateSystemCursor should set cursor on all views - #185080

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
arpitgandhi9:issue-140226
Aug 13, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
arpitgandhi9:issue-140226

Conversation

@arpitgandhi9

Copy link
Copy Markdown
Contributor

Fixes #140226

The mouse cursor was being set only on document.body, which caused two issues:

  1. It polluted the cursor for non-Flutter parts of the page
  2. It didn't work correctly when Flutter views were moved to Picture-in-Picture windows

This change:

  • Sets the CSS cursor property on each element instead of body
  • Applies the cursor change to all registered views simultaneously
  • Lets the browser's native CSS cursor switching handle per-element cursor changes automatically

This approach was agreed upon in the issue discussion as the best solution, avoiding the need to modify the framework protocol to send viewIds.

Changes:

  • MouseCursor.activateSystemCursor(): Now sets cursor on 'element' instead of document.body
  • platform_dispatcher.dart: Iterate over all views instead of just the first one
  • Updated tests to verify cursor is set on the view element, not body

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Apr 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the web engine to apply system mouse cursors to specific view elements rather than the document body, resolving several TODOs. Changes include iterating through all active views in the EnginePlatformDispatcher to update their respective cursors and adjusting tests to verify styles on the root view element. Feedback suggests optimizing the cursor activation loop by extracting the 'kind' argument lookup to avoid redundant map lookups for each view.

@flutter-zl
flutter-zl requested a review from mdebbar April 29, 2026 18:17
@mdebbar mdebbar added the CICD Run CI/CD label Jun 3, 2026

@mdebbar mdebbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #185080 at sha 61b2688

@flutter-dashboard flutter-dashboard Bot added the will affect goldens Changes to golden files label Jun 16, 2026
@github-actions github-actions Bot added team-web Owned by Web platform team and removed CICD Run CI/CD labels Jun 17, 2026
@mdebbar mdebbar added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 17, 2026
@auto-submit

auto-submit Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185080, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 17, 2026
@arpitgandhi9

Copy link
Copy Markdown
Contributor Author

@mdebbar Can you help in debugging this issue with Google testing? It says "Please contact Google Developer"

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 18, 2026
@mdebbar mdebbar added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 24, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 24, 2026
@auto-submit

auto-submit Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185080, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 24, 2026

@yjbanov yjbanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mdebbar mdebbar added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 24, 2026
@auto-submit

auto-submit Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185080, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 24, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Jul 27, 2026
@gaaclarke gaaclarke added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Jul 27, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 27, 2026
@auto-submit

auto-submit Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/185080, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

Fixes flutter#140226

The mouse cursor was being set only on document.body, which caused two issues:
1. It polluted the cursor for non-Flutter parts of the page
2. It didn't work correctly when Flutter views were moved to Picture-in-Picture windows

This change:
- Sets the CSS cursor property on each <flutter-view> element instead of body
- Applies the cursor change to all registered views simultaneously
- Lets the browser's native CSS cursor switching handle per-element cursor changes automatically

This approach was agreed upon in the issue discussion as the best solution, avoiding the need to modify the framework protocol to send viewIds.

Changes:
- MouseCursor.activateSystemCursor(): Now sets cursor on 'element' instead of document.body
- platform_dispatcher.dart: Iterate over all views instead of just the first one
- Updated tests to verify cursor is set on the view element, not body
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Jul 31, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Aug 5, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 12, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activateSystemCursor should set the cursor on all views

5 participants