Block Control 2.0.0 released
Published: – Leave a comment
Today is a good day for users of Block Control, as version 2.0.0 brings a new feature for hiding blocks by breakpoints.
WordPress Core added the block visibility setting to WordPress 6.9 to allow hiding blocks within certain viewports. As Block Control already is a handy tool to hide blocks by certain conditions, it was no question to adapt this functionality, too, and have it within a single tool.
Hiding by viewport
With version 2.0.0, Block Control allows you to select certain viewports where a block is hidden. The default viewports from WordPress (or your theme.json) are directly available, while adding custom ones is also possible. Once added, a custom viewport is usable throughout the whole website. The integrated client-side check for custom breakpoints also provides instant feedback whether the added viewport actually resolves in the browser and is valid.

You can also add multiple media queries so that the block is only hidden if all media queries apply.
More information about applying settings
Similar to the core functionality, the document overview now shows a little symbol with a tooltip if visibility settings apply to this block. Additionally, the icon in the block sidebar has been improved and now displays the tooltip, too. If no more visibility settings apply, screen reader users now get a notification about that and the focus is changed to the visibility panel instead of the page element.


Dependency upgrade
Reason for being a major update to version 2 is that the library for detecting mobile devices has been updated and thus requiring PHP 8.0 at least. This also lead to an updated code base with more modern features compared to the old one, which had to be compatible with PHP 5.6.
Tests
Not a feature you directly see, but for me worth mentioning: Block Control is now my first plugin with end-to-end testing, which means that the actual JavaScript interface is automatically tested within a browser, as well as the frontend (and whether the block hiding functionality works). These tests are also running in all supported PHP versions from 8.0 up to 8.5 to prevent errors due to usage of incompatible code.
It’s also fully tested against unit tests, static code analysis and code style.
That’s it
That were the biggest changes for Block Control 2.0.0. For all notable changes, please visit the changelog.
Likes
Reposts