Skip to content
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

Fix: The boolean attributes of video tag in wp_video_shortcode #7606

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

Debarghya-Banerjee
Copy link

@Debarghya-Banerjee Debarghya-Banerjee commented Oct 21, 2024

Trac Ticket : Core-60178

Overview

  • This pull request introduces updates to the wp_video_shortcode function to enhance the handling of boolean attributes and the preload attribute in accordance with HTML5 standards. These changes aim to ensure that the generated video elements are more compliant with modern web practices.

Changes Made

  • Boolean Attributes Handling

    • The loop, autoplay, and muted attributes are now output without values when their respective conditions are met. This aligns with HTML5 standards where these attributes can be treated as boolean.
  • Preload Attribute

    • The preload attribute has been updated to accept only specific allowed values: none, metadata, and auto. If a value outside of this list is provided, it will be ignored, preventing invalid attribute outputs.
  • Code Improvements

    • Enhanced readability and maintainability of the code, including better organization of attribute handling and validation.

Benefits

  • Improves compliance with HTML5 standards for video elements.

  • Ensures cleaner and more efficient HTML output.

  • Enhances user experience by properly managing video attributes based on their intended use.

Testing:

  • All existing tests related to video shortcode rendering have been updated to validate the new behavior of boolean attributes and the preload attribute.

  • This pull request aims to improve the functionality and reliability of video embeds in WordPress while adhering to current web standards.

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props debarghyabanerjee.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@Debarghya-Banerjee
Copy link
Author

Hi @joedolson , can you please take a look into this PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant