1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Fixed #34628 -- Improved icons accessibility of related widget wrapper in admin.

This improves accessibility of icons by making them larger and grayscale
(when not selected).
This commit is contained in:
Nina Menezes 2023-06-02 15:52:12 +01:00 committed by Mariusz Felisiak
parent e042024b28
commit 1699f8b52a
3 changed files with 10 additions and 11 deletions

View File

@ -579,16 +579,13 @@ ul.timelist, .timelist li {
}
.related-widget-wrapper-link {
opacity: 0.3;
opacity: .6;
filter: grayscale(1);
}
.related-widget-wrapper-link:link {
opacity: .8;
}
.related-widget-wrapper-link:link:focus,
.related-widget-wrapper-link:link:hover {
opacity: 1;
filter: grayscale(0);
}
select + .related-widget-wrapper-link,

View File

@ -9,7 +9,7 @@
data-href-template="{{ change_related_template_url }}?{{ url_params }}"
data-popup="yes"
title="{% blocktranslate %}Change selected {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-changelink.svg' %}" alt="">
<img src="{% static 'admin/img/icon-changelink.svg' %}" alt="" width="20" height="20">
</a>
{% endif %}
{% if can_add_related %}
@ -17,7 +17,7 @@
data-popup="yes"
href="{{ add_related_url }}?{{ url_params }}"
title="{% blocktranslate %}Add another {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-addlink.svg' %}" alt="">
<img src="{% static 'admin/img/icon-addlink.svg' %}" alt="" width="20" height="20">
</a>
{% endif %}
{% if can_delete_related %}
@ -25,14 +25,14 @@
data-href-template="{{ delete_related_template_url }}?{{ url_params }}"
data-popup="yes"
title="{% blocktranslate %}Delete selected {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-deletelink.svg' %}" alt="">
<img src="{% static 'admin/img/icon-deletelink.svg' %}" alt="" width="20" height="20">
</a>
{% endif %}
{% if can_view_related %}
<a class="related-widget-wrapper-link view-related" id="view_id_{{ name }}"
data-href-template="{{ change_related_template_url }}?{{ view_related_url_params }}"
title="{% blocktranslate %}View selected {{ model }}{% endblocktranslate %}">
<img src="{% static 'admin/img/icon-viewlink.svg' %}" alt="">
<img src="{% static 'admin/img/icon-viewlink.svg' %}" alt="" width="20" height="20">
</a>
{% endif %}
{% endif %}

View File

@ -16,7 +16,7 @@ class SeleniumTests(AdminSeleniumTestCase):
username="super", password="secret", login_url=reverse("admin:index")
)
def test_related_object_link_images_empty_alt(self):
def test_related_object_link_images_attributes(self):
from selenium.webdriver.common.by import By
album_add_url = reverse("admin:admin_views_album_add")
@ -34,6 +34,8 @@ class SeleniumTests(AdminSeleniumTestCase):
By.XPATH, f'//*[@id="{link_id}"]/img'
)
self.assertEqual(link_image.get_attribute("alt"), "")
self.assertEqual(link_image.get_attribute("width"), "20")
self.assertEqual(link_image.get_attribute("height"), "20")
def test_related_object_lookup_link_initial_state(self):
from selenium.webdriver.common.by import By