Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Jun 15, 2022

Description

This PR is an attempt to fix the Unexpected null value error thrown when using the Chrome DevTools on mobile mode and clicking on the top left corner.

Before this PR, the error is thrown because the pointerup handler expects that there was a previous pointerdown handler which called _ensureSanitizer for the device.

This is not the case when opening DevTools and switching it to mobile mode, because :

  • Chrome DevTools sends event of PointerDeviceKind.touch instead of PointerDeviceKind.mouse and create a new pointerId on each pointer down event.
  • Chrome DevTools set the event target to the html DOM element when the event is on the top left corner (elsewhere the target is Flutter Web glass pane). This is related to the <flt-semantics-placeholder> DOM element (the problem doesn't occur when this element is removed).

The fix included in this PR is to ignore pointer up and pointer cancel events when the device is unknown. This is to improve the developer experience (especially when the debugger is configured to break on Uncaught Exceptions).

Alternative solutions :

  • Digging in Chrome DevTools code (seems too complex for this case).
  • Changing how the Semantic placeholder is created (it doesn't seem sensible to change it for this edge case and it is not obvious which change can be made).

Related Issue

Fixes flutter/flutter#105458

Tests

Adds 1 test.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Jun 15, 2022
@yjbanov yjbanov requested a review from mdebbar June 16, 2022 18:17
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

LGTM

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 30, 2022
@auto-submit auto-submit bot merged commit f2ce880 into flutter:main Jun 30, 2022
@bleroux bleroux deleted the fix_flutter_web_unexpected_value branch June 30, 2022 06:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Unexpected null value and invoke debug when clicking left side of AppBar on Flutter Web

2 participants