[wp-trac] [WordPress Trac] #62131: WP Intreractivity API calculated classes aren't added

WordPress Trac noreply at wordpress.org
Tue Oct 1 15:27:25 UTC 2024


#62131: WP Intreractivity API calculated classes aren't added
-------------------------------+------------------------------
 Reporter:  mishaml            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Interactivity API  |     Version:  6.6.2
 Severity:  normal             |  Resolution:
 Keywords:  needs-patch        |     Focuses:
-------------------------------+------------------------------

Comment (by jonsurrell):

 Confirmed, with a store and HTML like the following, the `top-auto` class
 toggles correctly, while the `bottom-[-24rem]` does not.

 {{{
 import * as I from '@wordpress/interactivity';

 store( 'namespace', {
         handleTest() {
                 const prev = I.getContext().val;
                 I.getContext().val = !prev;
                 console.log(
                         'prev %o // next %o // updated %o',
                         prev,
                         !prev,
                         I.getContext().val,
                 );
         },
 })
 }}}

 {{{
 <div data-wp-interactive="namespace" data-wp-context='{"val": true}'>
         <div data-wp-class--top-auto="context.val"></div>
         <div data-wp-class--bottom-[-24rem]="context.val"></div>
         <button type="button" data-wp-on--click="handleTest">toggle
 val</button>
 </div>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62131#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list