[DOM] Add support for `onAnimationCancel` (#37609)
GitHub Commits - Example: React

[DOM] Add support for onAnimationCancel (#37609)

Commit 564923c [DOM] Add support for ## Summary AI Disclosure: This was assisted using Claude Code, Fable 5.1. This PR description was fully written by me, manually, and the code was reviewed and tested by me manually. This improves the accuracy of the animation-related event props supported by React. This adds onAnimationCancel alongside the existing onAnimationStart, onAnimationIteration, and onAnimationEnd props. Adds onAnimationCancel to React DOM, completing the animation event family alongside onAnimationStart, onAnimationIteration, and onAnimationEnd. animationcancel is a CSS Animations Level 1 event fired when an animation stops before it has completed. This changeset is based on the similar changes in #27345 for the transition events. Note that MDN's browser compat data currently claims that this is not supported in Chrome or Edge (at least not as onanimationcancel), but this change will work in Chrome 83+ due to React passing things through addEventListener anyway, and also the MDN docs are outdated about this, Chrome has started supporting onanimationcancel directly since earlier this year. Also note that the animation and transition events on DOMEventName can probably be made to no longer do this vendor prefixing dance? I didn't do that in this PR and it should be done separately, but they've not been prefixed in a long time now and the comment rationalizing the current code mentions Android 4.x, which was last released over a decade ago now. So it seems like something that has just never been cleaned up. ## How did you test this change? - Added tests to match the sibling properties' tests. - Ran yarn test, yarn lint, and yarn prettier and all passed. Co-authored-by: Claude Fable 5.1 onAnimationCancel (#37609)1 parent 019019b commit 564923c 7 files changed Lines changed: 90 additions & 2 deletions File tree - packages - react-dom-bindings/src/events - plugins - react-dom/src - tests - events/tests | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 13 | 13 | | | 14 | 14 | | | 15 | 15 | | | | 16 | + | | 16 | 17 | | | 17 | | - | | | 18 | + | | 18 | 19 | | | 19 | 20 | | | 20 | 21 | | | | ||| 115 | 116 | | | 116 | 117 | | | 117 | 118 | | | | 119 | + | | | 120 | + | | 118 | 121 | | | 119 | 122 | | | 120 | 123 | | | | Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 11 | 11 | | | 12 | 12 | | | 13 | 13 | | | | 14 | + | | 14 | 15 | | | 15 | 16 | | | 16 | 17 | | | | ||| 135 | 136 | | | 136 | 137 | | | 137 | 138 | | | | 139 | + | | 138 | 140 | | | 139 | 141 | | | 140 | 142 | | | | Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 10 | 10 | | | 11 | 11 | | | 12 | 12 | | | | 13 | + | | 13 | 14 | | | 14 | | - | | | 15 | + | | 15 | 16 | | | 16 | 17 | | | 17 | 18 | | | | Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 28 | 28 | | | 29 | 29 | | | 30 | 30 | | | | 31 | + | | 31 | 32 | | | 32 | 33 | | | 33 | 34 | | | | ||| 58 | 59 | | | 59 | 60 | | | 60 | 61 | | | | 62 | + | | 61 | 63 | | | 62 | 64 | | | 63 | 65 | | | | Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 32 | 32 | | | 33 | 33 | | | 34 | 34 | | | | 35 | + | | 35 | 36 | | | 36 | 37 | | | 37 | 38 | | | | ||| 133 | 134 | | | 134 | 135 | | | 135 | 136 | | | | 137 | + | | 136 | 138 | | | 137 | 139 | | | 138 | 140 | | | | Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| 56 | 56 | | | 57 | 57 | | | 58 | 58 | | | | 59 | + | | | 60 | + | | | 61 | + | | | 62 | + | | | 63 | + | | | 64 | + | | | 65 | + | | | 66 | + | | | 67 | + | | | 68 | + | | | 69 | + | | | 70 | + | | | 71 | + | | | 72 | + | | | 73 | + | | | 74 | + | | | 75 | + | | 59 | 76 | | | 60 | 77 | | | 61 | 78 | | | | Lines changed: 61 additions & 0 deletions | Original file line number | Diff line number | Diff line change | | |---|---|---|---| | ||| | 1 | + | | | 2 | + | | | 3 | + | | | 4 | + | | | 5 | + | | | 6 | + | | | 7 | + | | | 8 | + | | | 9 | + | | | 10 | + | | | 11 | + | | | 12 | + | | | 13 | + | | | 14 | + | | | 15 | + | | | 16 | + | | | 17 | + | | | 18 | + | | | 19 | + | | | 20 | + | | | 21 | + | | | 22 | + | | | 23 | + | | | 24 | + | | | 25 | + | | | 26 | + | | | 27 | + | | | 28 | + | | | 29 | + | | | 30 | + | | | 31 | + | | | 32 | + | | | 33 | + | | | 34 | + | | | 35 | + | | | 36 | + | | | 37 | + | | | 38 | + | | | 39 | + | | | 40 | + | | | 41 | + | | | 42 | + | | | 43 | + | | | 44 | + | | | 45 | + | | | 46 | + | | | 47 | + | | | 48 | + | | | 49 | + | | | 50 | + | | | 51 | + | | | 52 | + | | | 53 | + | | | 54 | + | | | 55 | + | | | 56 | + | | | 57 | + | | | 58 | + | | | 59 | + | | | 60 | + | | | 61 | + | 0 commit comments

Comments

No comments yet. Start the discussion.