Skip to content

[Bug]: react/no-unknown-property reports valid CSS Transition event handlers as unknown #3993

@rentalhost

Description

@rentalhost

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

The no-unknown-property rule only recognizes onTransitionEnd and onTransitionEndCapture from the CSS Transition events, but does not recognize the remaining standard transition event handlers.

These are valid DOM events listed on MDN's Element interface and are properly typed in @types/react (DefinitelyTyped source).

Missing event handlers (6):

  • onTransitionCancel
  • onTransitionCancelCapture
  • onTransitionRun
  • onTransitionRunCapture
  • onTransitionStart
  • onTransitionStartCapture

Reproduction:

// All of these trigger "Unknown property" warnings:
<div onTransitionCancel={() => {}} />
<div onTransitionCancelCapture={() => {}} />
<div onTransitionRun={() => {}} />
<div onTransitionRunCapture={() => {}} />
<div onTransitionStart={() => {}} />
<div onTransitionStartCapture={() => {}} />

These should be added to the DOM_PROPERTY_NAMES_TWO_WORDS array in lib/rules/no-unknown-property.js, alongside the already recognized onTransitionEnd and onTransitionEndCapture.

Note: there may be other missing event handlers following the same pattern (e.g. onAnimationCancel / onAnimationCancelCapture). The scope of this issue is focused on the transition events, but a broader audit of the event handler list against the current MDN Element interface and @types/react might be worthwhile.

Expected Behavior

The rule should recognize all standard CSS Transition event handlers without reporting them as unknown properties. Using onTransitionCancel, onTransitionRun, or onTransitionStart (and their Capture variants) on a DOM element should not trigger a warning.

eslint-plugin-react version

v7.37.5

eslint version

v10.1.0

node version

v24.14.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions