Replies: 1 comment
-
It’s curious that the first click doesn’t bubble and seems like something else must be calling One thing that might be worth a try in the "script" is to make the click listener capturing to catch the event before the bubble phase. If that’s doesn’t do it, adding the capture listener to the container rather than the individual buttons seems like it surely would but will require the handler to determine which button is clicked and what to do. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a BUTTON HTML element in a block I'm developing. When in the editor, if that button is activated (clicked on or Enter pressed when it has focus) I need the editor to select a specific inner block, while also letting the click event bubble up to other click handlers (e.g., a script that is specified in the "script" property of the block in block.json.
This is what I have so far:
This kind of works.
When I click on one of the buttons, the proper innerBlock is selected...but the HTML click event doesn't bubble of the other click handler in the script that is specified in the "script" property in block.json.
When I click on the button a 2nd time, that 2nd click does bubble up to the "script" JS handler.
Is there some other way I should be achieving the programmatic inner block selection that would make a 2nd click on the button unnecessary?
Beta Was this translation helpful? Give feedback.
All reactions