-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ActionMenu: don't swallow events attached via addEventListener (#2071)
- Loading branch information
Showing
4 changed files
with
40 additions
and
22 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/view-components': patch | ||
--- | ||
|
||
ActionMenu: don't swallow events attached via addEventListener |
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
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
21 changes: 21 additions & 0 deletions
21
previews/primer/alpha/action_menu_preview/with_actions.html.erb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script type="text/javascript"> | ||
window.addEventListener('load', function() { | ||
document.querySelector('button#alert-item').addEventListener('click', (_e) => { | ||
alert('Foo') | ||
}); | ||
}, false); | ||
</script> | ||
|
||
<%= render(Primer::Alpha::ActionMenu.new) do |component| %> | ||
<% component.with_show_button { "Trigger" } %> | ||
<% component.with_item(label: "Alert", tag: :button, id: "alert-item") %> | ||
<% component.with_item(label: "Navigate", tag: :a, content_arguments: { href: action_menu_landing_path }) %> | ||
<% component.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }) %> | ||
<% component.with_item( | ||
label: "Submit form", | ||
href: action_menu_form_action_path, | ||
form_arguments: { | ||
name: "foo", value: "bar", method: :post | ||
} | ||
) %> | ||
<% end %> |