Wednesday, April 17, 2024
26 changes
Enhancements to existing features
This update improves the documentation and testing of the throttleForAnimation function to help developers understand how to properly handle browser events that lose their context during asynchronous operations. The change includes better guidance and test cases showing how to track scroll event targets in Chrome, preventing potential issues when animations are throttled.
Original PR description
This is a followup on [1]. In Chrome the event's currentTarget is cleared after events such as "scroll" are handled. For asynchronously called methods to be able to access it, the current value of currentTarget needs to be kept. To help developers that might stumble on this issue when using `throttleForAnimation`, this commit emphasizes the fact that usage of that function is not limited to event handlers, and it adds a test case that illustrates a solution for tracking the lost scroll event target. No scenario was identified in 15.0, but this could be used as an alternative solution for [1]. [1]: https://github.com/odoo/odoo/commit/0ba601d2ef5c4e2f846818e78dcd23966d6f563d task-3449843 Forward-Port-Of: odoo/odoo#160969 Forward-Port-Of: odoo/odoo#131259