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

returnValue (html dialog element) code example appears to be broken (tested with Chrome, Firefox, Edge) #36456

Closed
rpbouman opened this issue Oct 23, 2024 · 1 comment
Labels
closed: duplicate This issue or pull request already exists

Comments

@rpbouman
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue

What specific section or headline is this issue about?

'Result' (i.e. the runnable code sample)

What information was incorrect, unhelpful, or incomplete?

In the "Examples" section, it reads:

The following example displays a button to open a containing a form via the showModal() method. The script assigns the returnValue an initial value of initialValue. The confirm button (confirmBtn) submits the form with validation and the "X" button submits the form without validation. Submitting a form with a method="dialog" closes the dialog and sets the return value to the value, if any, of the button or input elements of type=submit.

When I click the button from the runnable code sample, the dialog opens, but clicking either the "X" button, or the "Confirm" button fails to close the dialog. Also, the returnValue property of the dialog appears not to be changed when clicking the "Confirm" button.

What did you expect to see?

I expected the dialog to close after clicking either the "X" or the "Confirm" button, and I expected the code sample to print the dialog's "returnValue" property to indicate it changed due to clicking the "Confirm" button.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

I tested on windows 11 pro with

  • firefox 131.0.3 (64-bit)
  • google chrome 130.0.6723.70 (Official Build) (64-bit)
  • microsoft edge 130.0.2849.52 (Official build) (64-bit)

In the console of chrome and edge, I see this error message:

Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.

MDN metadata

Page report details
@rpbouman rpbouman added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Oct 23, 2024
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs and removed Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs labels Oct 23, 2024
@Josh-Cena
Copy link
Member

This example lacks permissions:

Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.

This is tracked in mdn/yari#11460.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2024
@Josh-Cena Josh-Cena added closed: duplicate This issue or pull request already exists and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants