#36284: Related lookup popup doesn't close after selecting an existing item
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
RelatedObjectLookups |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):
Thank you Matthias for your prompt and complete response! I will cleanup
my patch and propose a PR, I will include you as co-author.
I used our GH actions to verify and I can also confirm that the proposed
test change, without the corresponding code fix, fails as expected. From
the javascript test run log:
{{{
2025-04-01T15:14:56.5596976Z admin.RelatedObjectLookups >
dismissRelatedLookupPopup closes popup window...ERROR
2025-04-01T15:14:56.5598964Z >> Message: Died on test #1: Cannot read
properties of undefined (reading 'indexOf')
2025-04-01T15:14:56.5600137Z >> at
file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:14:7
2025-04-01T15:14:56.5601118Z >> Actual: undefined
2025-04-01T15:14:56.5601369Z >> Expected: undefined
2025-04-01T15:14:56.5601767Z >> TypeError: Cannot read properties of
undefined (reading 'indexOf')
2025-04-01T15:14:56.5602680Z >> at dismissRelatedLookupPopup
(file:///home/runner/work/django/django/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js:61:45)
2025-04-01T15:14:56.5604267Z >> at Object.<anonymous>
(file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:23:12)
2025-04-01T15:14:56.5659666Z admin.RelatedObjectLookups >
dismissRelatedLookupPopup removes window from relatedWindows array...ERROR
2025-04-01T15:14:56.5660853Z >> Message: Died on test #1: Cannot read
properties of undefined (reading 'push')
2025-04-01T15:14:56.5661535Z >> at
file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:27:7
2025-04-01T15:14:56.5661982Z >> Actual: undefined
2025-04-01T15:14:56.5662235Z >> Expected: undefined
2025-04-01T15:14:56.5662610Z >> TypeError: Cannot read properties of
undefined (reading 'push')
2025-04-01T15:14:56.5663318Z >> at Object.<anonymous>
(file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:33:27)
2025-04-01T15:14:56.6129232Z admin.RelatedObjectLookups >
dismissRelatedLookupPopup triggers change event for single value
field...ERROR
2025-04-01T15:14:56.6130896Z >> Message: Died on test #2: Cannot read
properties of undefined (reading 'indexOf')
2025-04-01T15:14:56.6133119Z >> at
file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:39:7
2025-04-01T15:14:56.6133918Z >> Actual: undefined
2025-04-01T15:14:56.6134960Z >> Expected: undefined
2025-04-01T15:14:56.6135655Z >> TypeError: Cannot read properties of
undefined (reading 'indexOf')
2025-04-01T15:14:56.6137289Z >> at dismissRelatedLookupPopup
(file:///home/runner/work/django/django/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js:61:45)
2025-04-01T15:14:56.6139511Z >> at Object.<anonymous>
(file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:55:12)
2025-04-01T15:14:56.6149250Z admin.RelatedObjectLookups >
dismissRelatedLookupPopup triggers change event for many-to-many
field...ERROR
2025-04-01T15:14:56.6155074Z >> Message: Died on test #2: Cannot read
properties of undefined (reading 'indexOf')
2025-04-01T15:14:56.6156351Z >> at
file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:59:7
2025-04-01T15:14:56.6157125Z >> Actual: undefined
2025-04-01T15:14:56.6157699Z >> Expected: undefined
2025-04-01T15:14:56.6158736Z >> TypeError: Cannot read properties of
undefined (reading 'indexOf')
2025-04-01T15:14:56.6160612Z >> at dismissRelatedLookupPopup
(file:///home/runner/work/django/django/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js:61:45)
2025-04-01T15:14:56.6162516Z >> at Object.<anonymous>
(file:///home/runner/work/django/django/js_tests/admin/RelatedObjectLookups.test.js:75:12)
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/36284#comment:7>