Opened 10 years ago

Last modified 10 years ago

#24406 closed Cleanup/optimization

SelectFilter should use click events instead of href javascript functions — at Version 3

Reported by: Rolf Jagerman Owned by: Rolf Jagerman
Component: contrib.admin Version: dev
Severity: Normal Keywords: admin SelectFilter javascript
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Rolf Jagerman)

SelectFilter uses javascript in an href to handle button behavior:

<a href="javascript:function(){...}">

This is problematic if one wishes to customize the widget, since the href javascript is executed after events are handled. It would be better to use a click event to handle this type of behavior:

someElement.addEventListener("click", function() { ... } );

I have proposed a patch on github:

https://github.com/django/django/pull/4205
https://github.com/rjagerman/django/tree/ticket_24406
https://github.com/rjagerman/django/commit/e07a0be20d6da81794eaa5b64c2927cc6c70410d

Change History (4)

by Rolf Jagerman, 10 years ago

Attachment: selectfilter.diff added

SelectFilter2.js git diff

comment:1 by Rolf Jagerman, 10 years ago

Description: modified (diff)

comment:2 by Rolf Jagerman, 10 years ago

Owner: changed from nobody to Rolf Jagerman
Status: newassigned

comment:3 by Rolf Jagerman, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top