Opened 5 weeks ago
Last modified 5 weeks ago
#64414 assigned defect (bug)
Block visibility based on screen size: add backend block support
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Editor | Keywords: | gutenberg-merge has-patch has-unit-tests |
| Focuses: | Cc: |
Description
WordPress 7.0 with build upon the block visibility block support introduced in 6.9, with functionality to allow hiding a block based on screen size.
Here are the relevant issues:
To that end, the backend block supports capability needs to be implemented with the following scope:
Block visibility block supports: Define and document the blockVisibility attribute to support both boolean (hide everywhere) and object format (per-device visibility). Define breakpoints constants consistent with those in the editor.
Frontend CSS output: Create PHP block support that generates CSS media queries and applies .wp-block-hidden-[device] classes to blocks based on their visibility settings.
A corresponding Gutenberg patch exists to guide development.
See also:
Change History (1)
This ticket was mentioned in PR #10629 on WordPress/wordpress-develop by @ramonopoly.
5 weeks ago
#1
- Keywords has-patch has-unit-tests added
This PR syncs the changes in https://github.com/WordPress/gutenberg/pull/73994. It:
displayproperty to thesafecss_filter_attrfunction.Unit tests:
To test manually, enable the experiment:
Then copy and paste this into your post editor, publish and view the frontend.
https://github.com/user-attachments/assets/45f86b73-f8f8-4763-a1eb-2303fda96105
Make sure to test with the experiment off as well. The last item should never show with the experiment on and off.