Home / Function/ trapClickOnNonInteractiveElement() — react Function Reference

trapClickOnNonInteractiveElement() — react Function Reference

Architecture documentation for the trapClickOnNonInteractiveElement() function in ReactDOMComponent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a0421d9a_64b7_2b13_1226_e3a3b9292e4e["trapClickOnNonInteractiveElement()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  a0421d9a_64b7_2b13_1226_e3a3b9292e4e -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  5a792874_dbaf_1dd0_9e62_d6a16580e0b5["setProp()"]
  5a792874_dbaf_1dd0_9e62_d6a16580e0b5 -->|calls| a0421d9a_64b7_2b13_1226_e3a3b9292e4e
  65717281_efda_4b8d_7a97_9947c26aa05e["setPropOnCustomElement()"]
  65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| a0421d9a_64b7_2b13_1226_e3a3b9292e4e
  894d4888_e1c9_cdd6_e0cb_7451b6fba151["hydrateProperties()"]
  894d4888_e1c9_cdd6_e0cb_7451b6fba151 -->|calls| a0421d9a_64b7_2b13_1226_e3a3b9292e4e
  style a0421d9a_64b7_2b13_1226_e3a3b9292e4e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 368–379

export function trapClickOnNonInteractiveElement(node: HTMLElement) {
  // Mobile Safari does not fire properly bubble click events on
  // non-interactive elements, which means delegated click listeners do not
  // fire. The workaround for this bug involves attaching an empty click
  // listener on the target node.
  // https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  // Just set it using the onclick property so that we don't have to manage any
  // bookkeeping for it. Not sure if we need to clear it when the listener is
  // removed.
  // TODO: Only do this for the relevant Safaris maybe?
  node.onclick = noop;
}

Domain

Subdomains

Frequently Asked Questions

What does trapClickOnNonInteractiveElement() do?
trapClickOnNonInteractiveElement() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is trapClickOnNonInteractiveElement() defined?
trapClickOnNonInteractiveElement() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 368.
What calls trapClickOnNonInteractiveElement()?
trapClickOnNonInteractiveElement() is called by 3 function(s): hydrateProperties, setProp, setPropOnCustomElement.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free