From 2ecc491f65e650136ba7225edc655aebe0f5bdfc Mon Sep 17 00:00:00 2001 From: Liam Hughes Date: Sat, 16 Mar 2019 15:29:56 +0000 Subject: [PATCH] I added the change into the 3.7 source by not the release source. (#615) This is in relation to issue https://github.com/emberjs/website/issues/3850 previously merged using pull request https://github.com/ember-learn/guides-source/pull/569 --- guides/release/templates/actions.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/guides/release/templates/actions.md b/guides/release/templates/actions.md index 0846ca109e..7eb0b73fbf 100644 --- a/guides/release/templates/actions.md +++ b/guides/release/templates/actions.md @@ -95,23 +95,23 @@ pressed down. ## Allowing Default Browser Action -By default, the `{{action}}` helper prevents the default browser action of the -DOM event. If you want to allow the browser action, you can stop Ember from -preventing it. +By default, the `{{action}}` helper prevents the default browser action of the DOM event (i.e. going to `newPage.htm`). So, for example see the following standard `a` tag with an `action`: -For example, if you have a normal link tag and want the link to bring the user -to another page in addition to triggering an ember action when clicked, you can -use `preventDefault=false`: +```handlebars +Go +``` + +**Clicking on this link does not go to `newPage.htm`** because the `action` has overridden this functionality. This is the default behavior for Ember. + +You can override this behavior and make this work more like a standard, non-ember, anchor tag by using the `preventDefault=false` overload of the action on an `a` tag. For example: ```handlebars Go ``` -With `preventDefault=false` omitted, if the user clicked on the link, Ember.js -will trigger the action, but the user will remain on the current page. +This still triggers the `logClick` action but then **we also go to `newPage.htm`.** -With `preventDefault=false` present, if the user clicked on the link, Ember.js -will trigger the action *and* the user will be directed to the new page. +You can specify `preventDefault=true` and this reverts to the standard Ember functionality (see previous example). ## Modifying the action's first parameter