[wp-trac] [WordPress Trac] #62131: WP Intreractivity API calculated classes aren't added
WordPress Trac
noreply at wordpress.org
Tue Oct 1 14:13:29 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):
Will you describe the desired result? The applied class names and what
you're seeing. The context is also important, is this used in a block?
I just did a quick test and this seemed to work correctly:
{{{
<div data-wp-context='{"isEditCard": true}'>
<div data-wp-class--top-auto="context.isEditCard"></div>
<div data-wp-class--bottom-[-24rem]="context.isEditCard"></div>
</div>
}}}
Processed result:
{{{
<div data-wp-context="{"isEditCard": true}">
<div class="top-auto" data-wp-class--top-
auto="context.isEditCard"></div>
<div class="bottom-[-24rem]" data-wp-class--
bottom-[-24rem]="context.isEditCard"></div>
</div>
}}}
Checking the elements via DOM APIs `el.classList.contains('top-auto')` and
`el.classList.contains('bottom-[-24rem]')` return `true` where expected.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62131#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list