Drupal Release: 9.2.0-alpha1
Pre Release
Tag Name: 9.2.0-alpha1
Release Date: 5/6/2021
DrupalHighly flexible, open-source content management system known for complex, scalable web applications. Preferred by government, educational, and large enterprise websites requiring advanced customization and security features. Robust module ecosystem.
TL;DR
Drupal 9.2.0-alpha1 introduces significant improvements to the Olivero theme, accessibility enhancements, performance optimizations, and developer experience improvements. This release focuses on modernizing JavaScript dependencies, improving entity query access checks, and enhancing the migration system. Key highlights include the introduction of a starterkit theme, the once.js utility for preventing duplicate JavaScript execution, and numerous accessibility fixes for the Olivero theme. This alpha release sets the foundation for Drupal 9.2.0 with over 5,000 changes across 300 files.
Highlight of the Release
- Introduction of a starterkit theme in core for easier theme development
- Addition of once.js utility to prevent duplicate JavaScript execution
- Major accessibility improvements to the Olivero theme
- Enhanced entity query access checks with explicit accessCheck parameter
- Improved migration system with better documentation and simplified code
- Updated JavaScript libraries including Popper.js, Tabbable, jQuery Form, and Modernizr
- New permission to control who can view user email fields
- Performance improvements in LibraryDependencyResolver and database operations
Migration Guide
Entity Query Access Checks
Developers should review their entity queries and explicitly set the accessCheck parameter to ensure proper behavior:
// Before
$entities = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['status' => 1]);
// After - explicitly state access check behavior
$entities = \Drupal::entityTypeManager()->getStorage('node')
->loadByProperties(['status' => 1], FALSE); // FALSE = do not check access
JavaScript Changes
If your code relies on jQuery UI's :tabbable selector, you should update to use the new focus management approach:
// Before
$(element).find(':tabbable').first().focus();
// After
Drupal.tabbable.tabbable(element)[0]?.focus();
Database API Changes
The 'throw_exception' option in the Database API has been deprecated:
// Before
$options = ['throw_exception' => FALSE];
$connection->query($query, [], $options);
// After
try {
$connection->query($query);
}
catch (\Exception $e) {
// Handle exception
}
once.js Usage
Update your JavaScript behaviors to use once() to prevent duplicate execution:
// Before
Drupal.behaviors.myBehavior = {
attach: function (context, settings) {
$(context).find('.my-selector').each(function () {
// Code that might run multiple times
});
}
};
// After
Drupal.behaviors.myBehavior = {
attach: function (context, settings) {
once('my-behavior', '.my-selector', context).forEach(function (element) {
// Code will run exactly once per element
});
}
};
Upgrade Recommendations
Recommendation
As this is an alpha release (9.2.0-alpha1), it is not recommended for production sites. This release is intended for developers and site builders who want to test new features and provide feedback before the stable release.
For production sites, continue using Drupal 9.1.x until Drupal 9.2.0 stable is released.
Testing Recommendations
- Test the new Olivero theme thoroughly, especially its accessibility features and mobile navigation
- Review custom entity queries to ensure they explicitly set the accessCheck parameter
- Test JavaScript behaviors with the new once.js utility
- Verify that custom themes work correctly with updated JavaScript libraries
- Test multilingual functionality, especially search and translations
- If using Layout Builder, test with various layout configurations
Module Compatibility
Module developers should begin testing their modules with this alpha release to ensure compatibility with Drupal 9.2.0 when it is released. Pay special attention to:
- Entity query usage
- JavaScript behaviors that might be affected by library updates
- Form handling and AJAX functionality
- Media and file handling
Bug Fixes
Menu and Navigation Issues
- Fixed issue where the "Add new Forum topic" button appeared incorrectly in forum containers
- Fixed Layout Builder assuming all breadcrumb links are routable
- Fixed issue where desktop dropdown menus required two taps/clicks to open
- Fixed issue where mouseout events closed navigation sub-menus even when focus was inside
Form and Input Issues
- Fixed issue where HTML wrappers were removed when adding HTML textfields using replacement patterns
- Fixed error when saving config entity with "Link to entity" checked in field formatters
- Fixed issue with text inputs creating horizontal scrolling at narrow viewports in Olivero
- Fixed issue with collapsible nav button text not being descriptive enough
Media and File Handling
- Fixed oEmbed URL resolution to take multiple endpoints into account
- Fixed issue where media types with missing source fields broke the status report page
- Fixed issue with file_url_transform_relative() not handling URLs with different ports
Multilingual and Translation Issues
- Fixed search results of multi-lingual pages failing Language of Parts
- Fixed incorrect link to translations
- Improved transliteration of Ukrainian letters
Theme and UI Issues
- Fixed off-canvas style resets overriding styles (especially SVGs)
- Fixed mobile menu appearing and then sliding out on page reload in Safari
- Fixed Windows high contrast mode not showing search icon in Olivero
- Fixed invalid aria attribute on sticky-header-toggle on fresh page load
- Fixed Layout Builder 33/34/33 layout broken in IE11
New Features
Starterkit Theme
A new starterkit theme has been added to core, providing a better starting point for theme developers to create custom themes.
once.js Utility
The once.js utility has been added to core, allowing developers to ensure JavaScript code runs only once per element, improving performance and preventing duplicate execution.
New Permission for User Email Fields
A new permission has been added to control who can view user email fields, providing better privacy control for user data.
Enhanced Focus Management
A new AjaxCommand for focusing elements has been created that does not require the :tabbable selector, improving accessibility and compatibility.
Extended Callback Process Plugin
The callback process plugin has been extended to call functions with multiple parameters, enhancing flexibility in the migration system.
Explicit Entity Query Access Checks
Entity queries now support an explicit accessCheck parameter, making it clearer when access checks should or should not be applied.
Security Updates
- Updated Nightwatch and locked dev dependencies to address security issues
- Applied security fix SA-CORE-2021-002
- Added tests for SA-CORE-2009-009
- Improved sanitization of filenames during upload with a new event
Performance Improvements
Database and Cache Optimizations
- Removed 'all' index from {key_value_expire} table, which served no purpose and negatively impacted performance
- Optimized LibraryDependencyResolver::getMinimalRepresentativeSubset() for a 4%+ performance gain
- Improved pager manager usage in PagerSelectExtender
- Simplified and sped up WorkspaceManager::isEntityTypeSupported()
- Reduced unnecessary work in FieldHelpTest
- Prevented preloading of routes generated by JSON:API in RoutePreloader
- Improved container rebuilding by avoiding duplicate rebuilds in drupal_rebuild()
JavaScript Improvements
- Added once.js to prevent duplicate JavaScript execution
- Updated various JavaScript libraries to newer versions:
- Popper.js to version 2.9.2
- Tabbable to version 5.2.0
- jQuery Form to 4.3.0
- Modernizr to latest version
- Underscore.js to version 1.13.1
Impact Summary
Drupal 9.2.0-alpha1 represents a significant step forward in Drupal's evolution with a focus on developer experience, accessibility, and performance. The introduction of the starterkit theme will make theme development more straightforward, while the once.js utility addresses a long-standing issue with JavaScript execution in Drupal.
The accessibility improvements in the Olivero theme demonstrate Drupal's commitment to creating inclusive experiences, with better keyboard navigation, focus management, and high contrast mode support. These changes will benefit all users but are particularly important for those using assistive technologies.
For developers, the explicit entity query access checks and improved database API provide better control and clarity, reducing the likelihood of security issues related to access control. The migration system improvements, including better documentation and simplified code, will make site migrations more reliable and easier to implement.
Performance optimizations in database operations and JavaScript execution will result in faster page loads and better user experiences, particularly on sites with complex layouts or large amounts of content.
While this is an alpha release and not recommended for production sites, it provides a preview of the significant improvements coming in Drupal 9.2.0 and gives developers time to prepare their sites and modules for compatibility.
Statistics:
User Affected:
- Access to a new starterkit theme in core for easier theme development
- Improved Olivero theme with better accessibility and UI enhancements
- BEM syntax improvements in Olivero for more consistent theming
- Updated JavaScript libraries including Popper.js, Tabbable, jQuery Form, and Modernizr
