Skip to content

data-auto-animate in react app → Uncaught TypeError: Cannot read properties of null (reading 'hasAttribute') #3592

@brandontrew

Description

@brandontrew

Getting error
Uncaught TypeError: Cannot read properties of null (reading 'hasAttribute') at k.run (reveal.esm.js:12:22298) at Xe (reveal.esm.js:12:92017) at Object.bt (reveal.esm.js:12:98202) at T.onDocumentKeyDown (reveal.esm.js:12:55350)

When trying to use data-auto-animate inside a react app. This same approach used to work before converting to a react Section component. But now animation fails.

I have the following Section output, which comes from a Section component, in a react-embedded reveal.js:

`

Animate selected objects during slide transitions with animate

  • Item 1
  • Item 3
  • Item 4
`

Here's the React component code that generates it:
return ( tempDivAttributes && slideOutput && ( <section ref={slideRef} data-hash={section.hash} data-slide-number={section.slideNum} {...tempDivAttributes} {...(tempDivAttributes['data-auto-animate'] ? { 'data-auto-animate': "1" } : {})} > {typeof slideOutput === 'string' ? parse(slideOutput) : slideOutput} </section> ) );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions