[wp-trac] [WordPress Trac] #62136: Interactivity API: Allow reading element attributes inside derived state props

WordPress Trac noreply at wordpress.org
Mon Sep 30 12:35:56 UTC 2024


#62136: Interactivity API: Allow reading element attributes inside derived state
props
-------------------------------+-----------------------------
 Reporter:  darerodz           |      Owner:  (none)
     Type:  feature request    |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Interactivity API  |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 Developers can define derived state props with `wp_interactivity_state`
 since WordPress 6.6 (see [https://make.wordpress.org/core/2024/06/28
 /updates-to-the-interactivity-api-in-6-6/#support-for-derived-state-props-
 inside-wp-interactivity-state Updates to the Interactivity API in 6.6]).
 However, they lack a function to obtain the current element's attributes,
 which is possible in JavaScript with the `getElement()` function exposed
 from `@wordpress/interactivity`.

 A PHP function equivalent to `getElement()` should be implemented to allow
 developers to write derived state props that depend on element attributes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62136>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list