Repository navigation
wp-bind attribute not setting properly on wp-bind--popover #77766
Description
Description
Summary
wp-bind return value mishandles the popover attribute.
data-wp-bind--popover="callbacks.popoverState" returns <div data-wp-bind--popover="callbacks.popoverState" popover="true">.
callbacks.popoverState returns "auto"|false but the attribute added to the DOM element is always string.
Expected Behavior
Per the docs I'd expect the attribute to exist/not-exist if a boolean value is returned, or to set the attribute equal to the returned string.
When wp-bind directive references a callback to get its final value:
The wp-bind directive will be executed each time there’s a change on any of the properties of the state or context used inside this callback.
The returned value in the callback function is used to change the value of the associated attribute.
The wp-bind will do different things when the DOM element is applied, depending on its value:
- If the value is
true, the attribute is added:<div attribute>- If the value is
false, the attribute is removed:<div>- If the value is a
string, the attribute is added with its value assigned:<div attribute="value">- If the attribute name starts with
aria-ordata-and the value is boolean (eithertrueorfalse), the attribute is added to the DOM with the boolean value assigned as a string:<div aria-attribute="true">
Concretely:
callbacks.popoverStatereturnstrue, the div should read<div popover>callbacks.popoverStatereturnsfalse, the div should read<div>callbacks.popoverStatereturns"auto", the div should read<div popover="auto">
Step-by-step reproduction instructions
- Scaffold an interactive block with
npx @wordpress/create-block --template @wordpress/create-block-interactive-template - Add a
booleanvalue to the block's state - Consume the newly created
booleanin the block'srender.phpwithdata-wp-bind--popover - Update
callbacks.logIsOpento logtypeof state['your-boolean-value']to ensure it is, in fact, a boolean.
Screenshots, screen recording, code snippet
Environment info
- WordPress via VS Code WordPress Playground Server (latest, 6.9)
- PHP 7.4
- Chrome 147.0.7727.117 (Official Build) (arm64)
- macOS 15.7.5
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure



Activity
luisherranz commentedon Apr 29, 2026
Looks legit, thanks for the reporting it, @kjroelke.
Instructions to solve this are as follows:
Create a PR using the following instructions:
preactdependency to10.29.1.test/e2e/specs/interactivity/directive-bind.spec.ts:203:8 › data-wp-bind › attribute hydration › value is correctly hydrated for different values. This fails becuase Preact, for some reason, has changed how it handlesnullassignments in thevalueattribute of input elements and we were testing that because there is a part of the Interactivity API that copies that behavior. Just fix it so the test passes again.And create another PR on top of that, using the following instructions:
gutenberg/packages/interactivity/src/directives.tsx
Lines 742 to 804 in ac38f00
USERSATOSHI commentedon Apr 29, 2026
Hi @luisherranz, thank you for sharing the approach. It seems there are additional changes related to the popup concerning focus, as keyboard-based focus appears to be failing: https://github.com/WordPress/gutenberg/actions/runs/25099983784/job/73546347497?pr=77785
I’m currently investigating what may have caused this.
USERSATOSHI commentedon Apr 29, 2026
Uh...., this is interesting 😅 .