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

Recieve error when using form action to redirect page #1264

Closed
saturnonearth opened this issue Apr 3, 2023 · 1 comment · Fixed by #1271
Closed

Recieve error when using form action to redirect page #1264

saturnonearth opened this issue Apr 3, 2023 · 1 comment · Fixed by #1271
Labels
bug Something isn't working

Comments

@saturnonearth
Copy link
Contributor

Current Behavior

I am currently using a form hidden within a popup to allow the user to logout. This submits a form action which triggers a redirect. After the user is redirect, the popup no longer exists since you are now on a page without the popup element existing.

Steps To Reproduce

  1. Clone example repo here (can't be done in Stackblitz as they don't allow form submissions)
  2. Open console
  3. Click Dashboard in upper right
  4. Click, Click Me! button, then click Sign Out
  5. See console for error

Anything else?

Error as shown:

DOMException: Failed to execute 'querySelectorAll'(popup.js:105 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Element': The provided selector is empty.)

@saturnonearth saturnonearth added the bug Something isn't working label Apr 3, 2023
@Sarenor
Copy link
Contributor

Sarenor commented Apr 4, 2023

Thanks for the excellent reproduction!
Seems to be a general issue with popups and this line in popup.ts:

  const interactiveMenuElems = elemPopup?.querySelectorAll(args.closeQuery || '');

When no closeQuery is provided it will default to empty string and that leads to a syntax error:

A string containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas.
(Source: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll?retiredLocale=de)

Should be an easy fix, I'll throw together a PR.

Thanks for reporting!

Sarenor pushed a commit to Sarenor/skeleton that referenced this issue Apr 4, 2023
Sarenor pushed a commit to Sarenor/skeleton that referenced this issue Apr 4, 2023
endigo9740 pushed a commit that referenced this issue Apr 4, 2023
* Fixed #1264 with early return

* Revert "Fixed #1264 with early return"

This reverts commit 4593e8b.

* Fixed the problem with the empty selector correctly.

---------

Co-authored-by: Dominik Röschke <dominik.roeschke@cloud37.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants