Skip to content

Conversation

@leevigraham
Copy link
Contributor

Description

Example was missing cancel button. Added a close button matching the /en-US/docs/Web/API/HTMLDialogElement/close example

Motivation

Fixing example.

Additional details

N/A

Related issues and pull requests

N/A

Example was missing cancel button.
Added a close button matching the /en-US/docs/Web/API/HTMLDialogElement/close example
@leevigraham leevigraham requested a review from a team as a code owner November 22, 2025 10:46
@leevigraham leevigraham requested review from wbamberg and removed request for a team November 22, 2025 10:46
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Nov 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 22, 2025

Preview URLs

(comment last updated: 2025-11-25 00:27:57)

@leevigraham leevigraham changed the title Add close button Add close button in htmldialogelement/show/index.md example Nov 22, 2025
<!-- Simple pop-up dialog box, containing a form -->
<dialog id="favDialog">
<form method="dialog">
<button type="button" id="close" aria-label="close">X</button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Can you change this to be "cancel" and then revert the other changes.

The main reason being that the text before this refers to it as a cancel button, and this is a minimal change to meet the original intent.

Copy link
Contributor Author

@leevigraham leevigraham Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I explicitly set the button label to "Cancel" rather than "X" to show clearer intent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the original intent to have the Cancel button be the reset button?

<button type="reset">Reset</button>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leevigraham Thanks! To make this easier to use and test the result, I made this a live example. As part of that I reverted the "X" button and updated the text so that it is clear that "Cancel" and X are the same thing - it just looks better. The extra heading levels are how API examples are supposed to be written according to the current web templates. I also modified the layout a little to kill the arbitrary line breaks.

Was the original intent to have the Cancel button be the reset button?

No, the reset button clears the selection in the dialog. We could talk about this but not sure it is relevant to the specific example. Do you think it would be better to delete that button?

Otherwise I am happy to merge this - just wanted to give you a chance to comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this was my first PR I didn't want to overstep with the live example…

Now I've seen a live example and reviewed the other Instance Method docs I've found some more inconsistencies:

I'm happy to attempt to create a PR that update all the Instance Method docs so the live examples all follow the same layout with javascript implementations reflecting the instance method

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be welcome. I'll merge this one though.

Note that you might want to link back to this PR to demonstrate the consistency you are trying to achieve. Reason being that I might not be the reviewer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a shot :)

@github-actions github-actions bot added size/xs [PR only] 0-5 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Nov 24, 2025
@github-actions github-actions bot added size/s [PR only] 6-50 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Nov 24, 2025
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @leevigraham !

@hamishwillee hamishwillee merged commit e1a895d into mdn:main Nov 25, 2025
8 checks passed
@leevigraham
Copy link
Contributor Author

@hamishwillee I've created a new PR for consolidating the dialog examples if you're interested: #42127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants