Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic chooser: links on result list lead to JSON response #11780

Open
th3hamm0r opened this issue Mar 21, 2024 · 4 comments
Open

Generic chooser: links on result list lead to JSON response #11780

th3hamm0r opened this issue Mar 21, 2024 · 4 comments
Labels
component:Choosers Modal choosers for Page, Snippet and other models status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug

Comments

@th3hamm0r
Copy link
Contributor

Issue Summary

Using the middle click on an entry in the result lists opens a JSON in a new tab.

It seems like the chooser modal uses this url to get its info on how to react on the selected result:
Bildschirmfoto vom 2024-03-21 16-58-55

Unfortunately, this leads some users to this page:
Bildschirmfoto vom 2024-03-21 17-00-09

To avoid having clueless users open a JSON page:
Can we use a different data-attribute to load the relevant data, but keep the edit-url in "href", so the middle click would work? Alternatively change the link to a button.

I've found #5408, which is basically the same issue with the page chooser, but in that case the link uses an anchor.

Steps to Reproduce

  1. Install the bakerydemo
  2. Log into the CMS and use a model chooser, e.g. open http://127.0.0.1:8000/admin/pages/82/edit/#panel-child-content-authors-section and change the existing selection with "Choose another Person".

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes

Technical details

  • Python version: 3.11
  • Django version: 4.2.x
  • Wagtail version: 5.2.x, latest main (6.1-dev)
  • Browser version: Firefox 123 (Linux)

Working on this

Anyone can contribute to this. View our contributing guidelines, add a comment to the issue once you’re ready to start.

@th3hamm0r th3hamm0r added type:Bug status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. component:Choosers Modal choosers for Page, Snippet and other models labels Mar 21, 2024
@lb-
Copy link
Member

lb- commented Mar 21, 2024

@th3hamm0r did the users right click and open in a new tab? How did they get the JSON response. The JavaScript is meant to make that link change the filtering within the modal.

@th3hamm0r
Copy link
Contributor Author

@lb- Middle click (by clicking on the mouse wheel).
Yes, ctrl+click and click are handled by js, middle click bypasses it somehow.

@th3hamm0r
Copy link
Contributor Author

Looks like there is a separate "auxclick"-event to handle those clicks:
https://developer.mozilla.org/en-US/docs/Web/API/Element/auxclick_event

@lb-
Copy link
Member

lb- commented Mar 21, 2024

Wow. Learned something new today,

I guess technically these elements should be buttons which is the callout in #5408

I remember now I did a PR to fix this actually #9209 but it wasn't being reviewed and it got painful to rebase haha.

The branch is still there though, maybe worth revisiting. We may also have some nicer options with Stimulus adoption though.

Maybe this bug can be closed and flagged as a duplicate of #5408 - and that issue updated to reflect Choosers generally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:Choosers Modal choosers for Page, Snippet and other models status:Unconfirmed Issue, usually a bug, that has not yet been validated as a confirmed problem. type:Bug
Projects
None yet
Development

No branches or pull requests

2 participants