-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gutenberg doesn't prevent default html events #49355
Comments
Hi,
|
Sorry, but I don't really understand what you mean. I tried add |
If you look closer at the linked pull request:
But in general I think it needs to be added per block, that Gutenberg should not prevent these events by default. |
Yeah. It's exacly what I did. My edit function looks like this: function edit({attributes, setAttributes}) {
return el('details', {...useBlockProps()}, [
el('summary', {
onClick: (event) => event.preventDefault()
}, [
el(RichText, {
value: attributes.label,
onChange: (newSummary) =>
setAttributes({label: newSummary}),
withoutInteractiveFormatting: true,
placeholder: 'Try to type Space',
})
]),
'INNER CONTENT HERE'
])
} UPD I just realized that the problem is not reproduced in Edge. Indeed, In Edge, you CAN type space. But, I test it in Firefox (112.0b7), and there, pressing spacebar doesn't type space chapter. Bug tracker |
This was fixed in #30244 but removed later in #41977. Also, we now have a core details block and the solution there is to use a div inside the summary element. #45055 Ideally, browsers should disable interactivity when an element is content editable (like they do for a link), so I'd recommend reporting it to them. |
Description
I tried to build simple block:
The problem is that it is not possible to type a space character into the RitchText, because pressing the space-key trigger details to toggle, rather than typing a space character.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
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
The text was updated successfully, but these errors were encountered: