Projet

Général

Profil

0001-a11y-add-filename-to-remove-file-icon-title-40878.patch

Frédéric Péters, 05 avril 2023 19:54

Télécharger (3,23 ko)

Voir les différences:

Subject: [PATCH] a11y: add filename to remove file icon title (#40878)

 wcs/qommon/static/js/qommon.fileupload.js           | 9 ++++++---
 wcs/qommon/templates/qommon/forms/widgets/file.html | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
wcs/qommon/static/js/qommon.fileupload.js
376 376
                    return;
377 377
                }
378 378
                $(base_widget).find('.fileprogress').hide();
379
                var base_file_name = data.result[0].name;
379 380
                if (data.result[0].url) {
380 381
                    $(base_widget).find('.filename').empty().append(
381
                        $('<a>', {href: data.result[0].url, download: data.result[0].name, text: data.result[0].name}));
382
                        $('<a>', {href: data.result[0].url, download: base_file_name, text: base_file_name}));
382 383
                } else {
383
                    $(base_widget).find('.filename').text(data.result[0].name);
384
                    $(base_widget).find('.filename').text(base_file_name);
384 385
                }
386
                var $remove_button = $(base_widget).find('a.remove');
387
                $remove_button.attr('title', $remove_button[0].dataset.titlePrefix + ' ' + base_file_name);
385 388
                $(base_widget).find('.fileinfo').show();
386 389
                $(base_widget).find('input[type=text]').val(data.result[0].token);
387 390
                $(base_widget).parents('form').find('div.buttons button').prop('disabled', false);
......
390 393
                $(base_widget).addClass('has-file').removeClass('has-no-file');
391 394
                $(this).trigger('change');
392 395
                $(base_widget).find('input[type=text]').trigger('change');
393
                $(base_widget).find('a.remove').focus();
396
                $remove_button.find('a.remove').focus();
394 397
            },
395 398
            fail: function(e, data) {
396 399
                $(base_widget).find('.fileprogress').addClass('upload-error');
wcs/qommon/templates/qommon/forms/widgets/file.html
28 28
        download="{{widget.tempfile.base_filename}}"
29 29
      >{{ widget.tempfile.base_filename }}</a>{% elif widget.tempfile %}{{ widget.tempfile.base_filename }}{% endif %}</p>
30 30
      {% if not widget.readonly %}
31
        <a href="#" role="button" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
31
        <a href="#" role="button" class="remove" data-title-prefix="{% trans "Remove the file:" %}" title="{% trans 'Remove the file:' %} {{ widget.tempfile.base_filename }}">{% trans "remove" %}</a>
32 32
      {% elif widget.has_tempfile_image %}
33 33
        <img alt="" src="tempfile?t={{ widget.tempfile.token }}&thumbnail=1"/>
34 34
      {% endif %}
35
-