Skip to content

Commit

Permalink
Changed /context_menu to fire a JS alert on a context click. Fixes sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
David Haeffner committed Jun 8, 2019
1 parent 4ac7d2e commit 8772ecc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions views/context_menu.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<menu type="context" id="menu">
<menuitem label="the-internet" onclick="window.alert('You selected a context menu')"></menuitem>
</menu>
<div class="example">
<h3>Context Menu</h3>
<p>Context menu items are custom additions that appear in the right-click menu.</p>
<p>Right-click in the box below to see one called 'the-internet'. When you click it, it will trigger a JavaScript alert.</p>
<div id='hot-spot' style="border-style: dashed; border-width: 5px; width: 250px; height: 150px;" contextmenu="menu">
<div id='hot-spot' style="border-style: dashed; border-width: 5px; width: 250px; height: 150px;" oncontextmenu="displayMessage()">
</div>
</div>

</br></br>
<strong>NOTE: This functionality currently only works on Firefox. See <a href="https://github.com/tourdedave/the-internet/issues/12">this open issue</a> for details.</strong>

<script>
function displayMessage() {
window.alert('You selected a context menu')
}
</script>

0 comments on commit 8772ecc

Please sign in to comment.