Skip to content

MudEventManager: Correctly handle TouchList properties in touch-related events#10714

Merged
henon merged 3 commits intoMudBlazor:devfrom
pwasilewski:fix/stringify-touchEventArgs
Feb 1, 2025
Merged

MudEventManager: Correctly handle TouchList properties in touch-related events#10714
henon merged 3 commits intoMudBlazor:devfrom
pwasilewski:fix/stringify-touchEventArgs

Conversation

@pwasilewski
Copy link
Contributor

@pwasilewski pwasilewski commented Jan 26, 2025

Description

This update improves the event handler to correctly handle TouchList properties in touch-related events. The TouchList, a specialized collection of touch points (e.g., for multitouch), is now converted into a standard array of objects. Each touch point is transformed into a plain object with properties such as identifier, screenX, screenY, clientX, clientY, pageX, and pageY, making it suitable for JSON serialization (as per ASP.Net Core TouchPoint documentation).

This is especially important for ASP.Net scenarios, where the TouchList cannot be directly serialized into a format that the framework can process. The transformation ensures that the touch points are sent as an array of objects (TouchPoint[]), which can be properly deserialized (as per ASP.Net Core TouchEventArgs documentation).

image

touchlist2

fix #10632

How Has This Been Tested?

Visually

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added the bug Unexpected behavior or functionality not working as intended label Jan 26, 2025
@pwasilewski pwasilewski marked this pull request as ready for review January 26, 2025 00:04
@pwasilewski pwasilewski changed the title mudEventManager: Fix stringify TouchList MudEventManager: Fix stringify TouchList Jan 26, 2025
@ScarletKuro
Copy link
Member

Hi, thanks for the PR

image

Where is that table from? Can't find it.

@ScarletKuro ScarletKuro requested a review from henon January 26, 2025 09:40
@pwasilewski
Copy link
Contributor Author

To be honest I asked ChatGPT for the Browser Compatibility. You can have a similar result with CoPilot:
image

@mikes-gh
Copy link
Contributor

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 26, 2025

And Firefox partially supported.
Looks like need to check if its a touch device?
Probably would need checking on those devices to make sure it doesnt introduce any regressions

@pwasilewski
Copy link
Contributor Author

Sorry for the mistake. I was thinking: since TouchList is causing so many issues, maybe we should just go back to basics. We can check the property name to catch TouchList fields and, to make it more solid, also check event.type to keep this logic limited to touch events. What do you think?

@codecov
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.83%. Comparing base (7a94bc3) to head (75be35d).
Report is 11 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10714      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         427      427              
  Lines       13428    13428              
  Branches     2591     2591              
==========================================
- Hits        12333    12332       -1     
  Misses        523      523              
- Partials      572      573       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mikes-gh
Copy link
Contributor

Funny how AI gives different results to caniuse.

@sonarqubecloud
Copy link

@henon
Copy link
Contributor

henon commented Feb 1, 2025

Funny how AI gives different results to caniuse.

That's why IMO AI is overhyped ATM because you can't trust it. People are slowly discovering that you need to check everything it produces, so it isn't really useful for automation.

@henon henon changed the title MudEventManager: Fix stringify TouchList MudEventManager: Correctly handle TouchList properties in touch-related events Feb 1, 2025
@henon henon merged commit c31c79c into MudBlazor:dev Feb 1, 2025
6 checks passed
@henon
Copy link
Contributor

henon commented Feb 1, 2025

Thanks @pwasilewski !

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

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TouchEventArgs is not been stringify correctly by eventHandler

4 participants