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

Example HTML Dialog #2743

Open
NPBogdan opened this issue Feb 25, 2024 · 3 comments
Open

Example HTML Dialog #2743

NPBogdan opened this issue Feb 25, 2024 · 3 comments
Assignees
Labels
awaiting response goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content.

Comments

@NPBogdan
Copy link

What information was incorrect, unhelpful, or incomplete?

I believe it's not working as expected. The part where you handleUserInput(). I believe something is not correct.

What did you expect to see?

I expect to see a selected option in the output div, but it shows the btn value. I hope i'm not wrong. I understand the code but i think you wanted to show a selected option.

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

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

Do you have anything more you want to share?

Nope.

@NPBogdan NPBogdan added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Feb 25, 2024
Copy link

It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

@caugner caugner added the goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content. label Mar 15, 2024
@bsmth
Copy link
Member

bsmth commented Apr 9, 2024

Thanks a lot for opening this one. I took a look through this and I agree it's a little hard to tell what the intention is. What do you think about reducing it down to something like:

<dialog id="termsDialog">
  <p>Do you agree to the Terms of Service(link)?</p>
  <button id="declineButton" value="declined">Decline</button>
  <button id="acceptButton" value="accepted">Accept</button>
</dialog>

<p>
  <button id="openDialog">Review ToS</button>
</p>
<p id="statusText"></p>

And in the JS we have something like:

  // setup etc.
  
  termsDialog.addEventListener('close', () => {
    statusText.innerText = 'ToS dialog return value: ' + termsDialog.returnValue;
  });
@bsmth bsmth self-assigned this Apr 9, 2024
@bsmth bsmth added awaiting response and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Apr 9, 2024
@github-actions github-actions bot added the idle Issues and pull requests with no activity for three months. label May 11, 2024
@low-perry
Copy link

low-perry commented Jun 15, 2024

Hello, I was reading through this issue and noticed the following sentences:

I expect to see a selected option in the output div, but it shows the btn value. I hope i'm not wrong. I understand the code but i think you wanted to show a selected option.

I think the intent of the author of the docs is to show, how the returnValue property of the <dialog> element works.
It states that this property "gets or sets the return value for the dialog, usually to indicate which button the user pressed to close it". And if that's the case, the intent was never to show which option the user chose from the dropdown, but what button closed the dialog.

@github-actions github-actions bot removed the idle Issues and pull requests with no activity for three months. label Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content.
4 participants