Fix: Default attribute on audio preload #21735
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.
Description
Fixes: #13802
Currently, the audio block assumes "none" as the default for the audio block preload attribute. This is problematic because the default is browser-specific and the default recommendation is "metadata" not none as documented in https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio.
This difference may make preloading happen even when it was explicitly set to none as #13802. documents.
This PR proposes the introduction of a default preloading option called "Browser default" that uses the default on each browser, and then it allows the user to explicitly set any value.
How has this been tested?
I created an audio block in the master version of Gutenberg with all the three values for preload.
I reloaded the editor on this branch and verified all the blocks are valid.
I verified when I select the "Browser default" option the markup does not contain a preloading attribute (it uses the browser default) all the other options are explicitly saved in the markup.