Skip to content
Snippets Groups Projects
Verified Commit 07c0011d authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2998857 by Luke.Leber, e.chatrer, afem, bskibinski, mgifford: a11y:...

Issue #2998857 by Luke.Leber, e.chatrer, afem, bskibinski, mgifford: a11y: Input type file fields lack aria-describedby to the description

(cherry picked from commit 74b6ceda)
parent fee6f4e0
No related branches found
No related tags found
11 merge requests!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8949Backport .gitlabci.yml changes.,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #220585 passed
Pipeline: drupal

#220614

    Pipeline: drupal

    #220607

      Pipeline: drupal

      #220600

        +1
        ......@@ -320,6 +320,11 @@ public static function processManagedFile(&$element, FormStateInterface $form_st
        '#weight' => -10,
        '#error_no_message' => TRUE,
        ];
        if (!empty($element['#description'])) {
        $element['upload']['#attributes']['aria-describedby'] = $element['#id'] . '--description';
        }
        if (!empty($element['#accept'])) {
        $element['upload']['#attributes'] = ['accept' => $element['#accept']];
        }
        ......
        ......@@ -41,6 +41,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $tree = T
        $form['nested']['file'] = [
        '#type' => 'managed_file',
        '#title' => $this->t('Managed <em>@type</em>', ['@type' => 'file & butter']),
        '#description' => $this->t('Upload a <em>@type</em> file', ['@type' => 'file & butter']),
        '#upload_location' => 'public://test',
        '#progress_message' => $this->t('Processing...'),
        '#extended' => (bool) $extended,
        ......
        ......@@ -4,6 +4,7 @@
        namespace Drupal\Tests\file\Functional;
        use Drupal\Component\Utility\Html;
        use Drupal\file\Entity\File;
        /**
        ......@@ -40,8 +41,14 @@ public function testManagedFile(): void {
        $input_base_name = $tree ? 'nested_file' : 'file';
        $file_field_name = $multiple ? 'files[' . $input_base_name . '][]' : 'files[' . $input_base_name . ']';
        // Submit without a file.
        $this->drupalGet($path);
        // Ensure the aria-describedby relationship works as expected.
        $input_id = Html::getId('edit_' . $input_base_name);
        $this->assertSession()->elementExists('css', '#' . $input_id . '--description');
        $this->assertSession()->elementExists('css', '[aria-describedby="' . $input_id . '--description"]');
        // Submit without a file.
        $this->submitForm([], 'Save');
        $this->assertSession()->pageTextContains("The file ids are .");
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment