django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.73k stars 574 forks source link

Removing an images jumps the screen to the top of the page #1452

Closed marcosguedes closed 1 month ago

marcosguedes commented 3 months ago

Hi all. The X button on a FilerImageField has an href="#" which sends the user to the top of the page when clicked.

image

I tested this on Django 3, not sure if it happens on others. Quite strange to not see it reported sooner.

The small fix I did was to simply replace # with javascript:void(0); in admin_file.html which seemed to take care of the problem

            <a class="filerClearer {% if not object %}hidden{% endif %}" title="{% translate 'Clear' %}"
-                 data-no-icon-file="{% static 'filer/icons/file-unknown.svg' %}" href="#">
+                 data-no-icon-file="{% static 'filer/icons/file-unknown.svg' %}" href="javascript:void(0);">
                <span class="fa fa-close filer-icon filer-icon-remove-selection"></span>
            </a>

admin_folder.html should also have the same problem but I haven't tested yet

fsbraun commented 1 month ago

Completed with #1453

marcosguedes commented 1 month ago

Thank you, perfect, this looks much more clean than my fix