The issue involves fixing property mapping and moving logic into useEffect, but overlaps with ongoing work.
The issue involves two problems with the cover block: incorrect `backgroundType` property mapping and incorrect overlay opacity/text color settings when adding new images. The fixes require modifying property mapping and moving logic into `useEffect`, but there is potential overlap with ongoing work by another contributor.
This tracks some issues with the cover block related to the 'Block Fields' experiment.
A prerequisite for testing is to enable the 'Block Fields' experiment on the Gutenberg experiment page.
backgroundType not set correctlyAfter #74575, there's a small issue with the cover block. The backgroundType property is not set correctly when adding a video using the media field in the inspector.
I believe this line is the problem: https://github.com/WordPress/gutenberg/blob/b06f167d4ecf1b38d22da21f58d5d0911fd56c3c/packages/block-library/src/cover/index.js#L88
It should read:
backgroundType: value.mediaType,
It's probably worth rolling this fix into other cover block fixes.
isDark) are not set correctly when adding new imagesSteps to reproduce:
Cause:
I think that the issue is that the block has some internal logic for calculating the dimRatio and isDark - https://github.com/WordPress/gutenberg/blob/b06f167d4ecf1b38d22da21f58d5d0911fd56c3c/packages/block-library/src/cover/edit/index.js#L194-L261
This code executes whenever uploading new images from the block, but not if some external code (like the Block Fields) tries to set a new image. A fix might be to move the code into a useEffect.
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!