Problem/Motivation
I noticed an UX regression in the File and Image Widget. The table header is always visible. The bug was introduced in #1898070: file.module - Convert theme_ functions to Twig Commit a4a887ac.
This is the related hunk from commit a4a887ac function template_preprocess_file_widget_multiple.
- $output = empty($rows) ? '' : drupal_render($build);
- $output .= drupal_render_children($element);
- return $output;
+ $variables['element'] = $element;
I think should keep the previous behaviour.
HEAD without patch

HEAD with patch

Beta phase evaluation
Proposed resolution
Only display the table header when there are files.
Remaining tasks
None at this time.
User interface changes
The previous behaviour will be restored: The table header will only be displayed when there are files.
API changes
n/a
Comments
Comment #1
webflo commentedComment #2
star-szrGood catch @webflo! Code looks good, should we add a small test?
Comment #3
rogerlenoir commentedThanks webflo. The patch still applies and solves the problem.
Comment #4
rogerlenoir commentedComment #5
claudiu.cristeaAdded also the test. There's "test only" patch proving the regression.
Comment #7
star-szrLooks good, has tests, thanks! Filled out the issue summary and added a beta evaluation.
Comment #8
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed c2b35b0 and pushed to 8.0.x. Thanks!