-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Labels
[Feature] Block Validation/DeprecationHandling block validation to determine accuracy and deprecationHandling block validation to determine accuracy and deprecation[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Description
Previously reported in #38978
In the save function if someone uses an anchor tag (a) with target='_blank' attribute, it shows the Attempt Block Recovery screen on every reload.
Cause:
if there is a target='_blank' in the anchor tag, it adds rel='noopener' in the block.originalContent automatically which causes the block validation error.
Please check the code snippet below:
When there is a target attribute, here block.originalContent gets rel attribute but generatedBlockContent doesn't.
gutenberg/packages/blocks/src/api/validation/index.js
Lines 732 to 736 in 984160d
| const isValid = isEquivalentHTML( | |
| block.originalContent, | |
| generatedBlockContent, | |
| logger | |
| ); |
cc: @talldan
Step-by-step reproduction instructions
- Create a custom block
- In the save function add an anchor tag with
targetattribute and don't addrelattribute - Save this block in the editor and reload.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress: 5.9.1
- Gutenberg: 12.7.0-rc.1
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Block Validation/DeprecationHandling block validation to determine accuracy and deprecationHandling block validation to determine accuracy and deprecation[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.