Blocks: Render Button RichText as div #8451
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes (one of two) #8440
This pull request seeks to resolve an issue where removing all text from a Button block by backspace would cause subsequent text changes to not be accurately reflected.
It's expected that this is a broader issue with TinyMCE compatibility of inline elements as the root container of a text field (see also tinymce/tinymce#4488). This may be something we want to avoid altogether, instead applying equivalent inline behaviors by styling. As implemented in the Button component, the default
div
visually appears identical and resolves the issue described in #8440.Since I've also noticed issues with the Quote block's use of the
cite
element, I may propose that we consider avoiding inline elements for all instances of RichText. I will create a separate issue for this if agreeable.Testing instructions:
Repeat steps to reproduce from #8440 (comment) , verifying that all text changes are respected. It should also behave differently in that the Placeholder will be shown again when all text is removed by Backspace.
Verify there are no styling regressions in the display of the Button block in the editor.