Send original event details in combobox-commit CustomEvent#66
Merged
Conversation
|
👋 Hello and thanks for pinging us! This issue or PR has been added to our inbox and a Design Infrastructure first responder will review it soon.
|
koddsson
approved these changes
Dec 13, 2022
Comment on lines
+187
to
+188
| function fireCommitEvent(target: Element, originalEvent?: MouseEvent): void { | ||
| target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail: {originalEvent}})) |
Contributor
There was a problem hiding this comment.
Nitpick; What do you think about taking in details as a argument so that we adhere more to the API of CustomEvent?
Suggested change
| function fireCommitEvent(target: Element, originalEvent?: MouseEvent): void { | |
| target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail: {originalEvent}})) | |
| function fireCommitEvent(target: Element, detail: Record<string, unknown> | undefined = undefined): void { | |
| target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true, detail})) |
(☝🏻 I wrote this suggestion in the GitHub comment box so it might be wrong)
rezrah
reviewed
Dec 13, 2022
|
|
||
| function fireCommitEvent(target: Element): void { | ||
| target.dispatchEvent(new CustomEvent('combobox-commit', {bubbles: true})) | ||
| function fireCommitEvent(target: Element, originalEvent?: MouseEvent): void { |
There was a problem hiding this comment.
Nit. For simplicity and consistency with the other arguments in this file, I think this could just be event as there's no superseding assignment or event mutation inside the closure. When I see original*, I usually expect something to happen to it after but it's just being forwarded here.
Contributor
Author
koddsson
approved these changes
Dec 14, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I want to get some additional information about the originating trigger of the commit event (whether the
ctrlKeyormetaKeyare pressed) to determine whether links should be opened in a new tab or not. Seems that information is not preserved in thecombobox-commitCustomEvent.I plumbed it through via details, lmk if you think this is reasonable