UI refers to "files" when you can only upload one file

Created on 1 February 2024, about 1 year ago
Updated 9 April 2024, 11 months ago

Problem/Motivation

The Add or Select Media dialog is inconsistent about use of singular and plural, which could cause editor confusion. It would be better to be consistent.

Steps to reproduce

1. Create a Drupal Core site in simplytest.me
2. Log in as admin
3. Go to /admin/modules
4. Filter on media
5. Enable Media and Media Library
6. Click Install
7. Upon completion, go to /admin/config/content/formats/manage/basic_html
8. Drag the picture icon out of the active area
9. Drag the media icon into the active area
10. Under Enabled Filters, check Embed media
11. Under Filter Settings, Embed media, check all boxes
12. Click Save configuration
13. Go to /node/add/page
14. Click the Insert media icon

Expected result:
Add file
Choose file
no file selected
One file only

Actual result:
Add file
Choose files
no files selected
One file only

Proposed resolution

Change above plurals to singular

Merge request link

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.3

Component
Media 

Last updated about 9 hours ago

Created by

🇺🇸United States charles belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @charles belov
  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 year ago
    Total: 162s
    #117996
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India sukr_s

    patch enclosed. #multiple is set based on the number of files upload allowed. this sets the ui text properly

  • 🇮🇳India dineshkumarbollu

    @sukr_s

    MR fails pipeline due to phpcs, can you fix that i can review the MR, Thanks

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Pipeline finished with Canceled
    12 months ago
    Total: 10s
    #118787
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sukr_s

    PHPCBF issue fixed

  • Pipeline finished with Failed
    12 months ago
    Total: 612s
    #118788
  • Status changed to Needs work 12 months ago
  • 🇺🇸United States smustgrave

    As a bug will need a failing test to show the issue.

  • Status changed to Needs review 12 months ago
  • 🇮🇳India sukr_s

    @smustgrave The fix resolves correctness of English in UI (plural vs. singular). Not sure how to add tests for this. If you can point to some documentation, that would be helpful.

  • Status changed to Needs work 12 months ago
  • 🇺🇸United States smustgrave

    MR has a test failure

    UI changes should also have before/after screenshots in the issue summary.

    Tests can be a simple assertion added to an existing test.

  • Pipeline finished with Failed
    12 months ago
    Total: 176s
    #124097
  • Pipeline finished with Failed
    12 months ago
    Total: 635s
    #124206
  • Pipeline finished with Success
    12 months ago
    Total: 482s
    #124221
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sukr_s

    MR updated with fix and test cases have been updated as well.

  • Status changed to Needs work 12 months ago
  • 🇺🇸United States smustgrave

    Left a comment.

  • Status changed to Needs review 12 months ago
  • 🇮🇳India sukr_s

    following line is the positive test cases.

    $choose_files->hasButton('Choose file');

  • Assigned to sukr_s
  • Status changed to Needs work 12 months ago
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • 🇮🇳India sukr_s

    The button label has to change to "Choose file". I believe there is no way to assert this (or?). Attach screenshot from the automated run that shows that the label has been successfully changed

  • Status changed to RTBC 12 months ago
  • 🇺🇸United States smustgrave

    Yea in that case I think the negative assertions should be fine.

  • Status changed to Needs work 12 months ago
  • 🇬🇧United Kingdom catch

    One question on the MR.

  • Status changed to RTBC 12 months ago
  • 🇮🇳India sukr_s

    The original code was always for "multiple files" and the test cases as well. The UI showed upload "files" even when a single file was being uploaded. So the fix was for ensuring that the right text is shown in the UI in case of single file upload. No other functionality or test cases are affected. e.g. line 300

     // Assert we can add multiple files.
     $this->assertTrue($assert_session->fieldExists('Add files')->hasAttribute('multiple'));
    

    tests for multiple files

    • catch committed d0469464 on 10.3.x
      Issue #3418781 by sukr_s, Charles Belov, smustgrave: UI refers to "files...
    • catch committed f4bf71d6 on 11.x
      Issue #3418781 by sukr_s, Charles Belov, smustgrave: UI refers to "files...
  • Status changed to Fixed 12 months ago
  • 🇬🇧United Kingdom catch

    Ahh yeah, bad ctrl-f on my part it looks like, I can see coverage for both 'Add file' and 'Add files' now.

    Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024