-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add request-close command for dialogs #11045
Open
lukewarlow
wants to merge
6
commits into
whatwg:main
Choose a base branch
from
lukewarlow:request-close-command
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−28
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
830339d
Add request-close command for dialogs
lukewarlow 0b2bccb
Address comments
lukewarlow 990132e
lowercase dialog
lukewarlow 26c9782
Address comments
lukewarlow 627ea99
Update request-close and close command handling of button value attri…
lukewarlow 82c7bd0
Address comment
lukewarlow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we set it to null and not the empty string? With
button
elements it can never become null but that doesn't seem to matter as null and the empty string are always handled identically in close the dialog? So maybe we should remove that distinction? Probably okay as a follow-up, though might be nice to do here as now we're adding additional callers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null and the empty string aren't handled identically. If it's an empty string it replaces returnValue, if it's null returnValue isn't set to the new value (so keeps it's old value). Step 10 https://html.spec.whatwg.org/multipage/interactive-elements.html#close-the-dialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there no desire for this new feature to be able to emulate that then? Should this not be called out somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've found a spec issue here, because Chrome does distinguish between button with a value attribute and button without. I'm just looking into it now.
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit - the existing place does "if submitter has a value", is that correct spec language that I can copy? I don't know if has a value is really defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
button
element is defined to always have a value. See itsconcept-fe-value
definition.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out there's an interop issue here, WebKit and Chrome behave different to Firefox (which follows the spec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the spec for close and request-close commands to check for the attributes existence before using the value. I'm checking WPTs for command invokers now to see if this case is covered if not I'll add them to the linked test PR. I'll raise a separate issue for the dialog form case: #11092
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added tests to that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then set*
But if we have to do this for all consumers of concept-fe-value maybe it should be defined differently. Hmm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah perhaps as part of #11092 we'll need to revise how this is written.