HTML Comments Improve Experience Builder Previews in Drupal
Wim Leers reports on HTML comments in Experience Builder (XB) during week 30, covering infrastructure updates and refinements. The "Publish" button introduced earlier remains while server-side support for auto-saving entities is now in place. Recent developments include adding an SEO-focused media image field to the Page content entity type, refactoring Redux-integrated field widgets for improved UI integration, and addressing accurate previews using HTML comments instead of unreliable data attributes. The new Twig extension wraps Single Directory Components (SDCs) in comment tags to improve XB’s ability to match hovered or selected HTML to the component tree without affecting CSS or JavaScript behaviour. Additionally, XB now requires Drupal 11.1 or newer due to changes in block plugin validation while maintaining backward compatibility with Drupal 10.4. These updates contribute to XB’s long-term goal of achieving real-time previews with in-place editing.