Skip to content
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

Idea for a new rule: No target="_blank" for LinkTo #2925

Open
amk221 opened this issue Jun 22, 2023 · 0 comments
Open

Idea for a new rule: No target="_blank" for LinkTo #2925

amk221 opened this issue Jun 22, 2023 · 0 comments

Comments

@amk221
Copy link
Contributor

amk221 commented Jun 22, 2023

Here is the scenario I'd like to guard against...

  1. User visits a page and enters some form information
  2. Users clicks a LinkTo to read Terms and Conditions (with target="_blank")
  3. Browser blocks popup
    (it offers the user to "Allow anyway", but is sometimes missed by users because it's small and in the address bar)
  4. The Ember router continues to the link destination in the user's main tab.
  5. The user presses back
  6. The user has lost their form details

This is solved by switching to a hyperlink instead of a LinkTo

Before

<LinkTo @route="terms-and-conditions" target="_blank">
  Terms and Conditions
</Linkto>

After

<a href={{url-for "terms-and-conditions"}} target="_blank">
  Terms and Conditions
</a>

Along with

class UrlForHelper extends Helper {
  @service router;

  compute(args) {
    return this.router.urlFor(...args);
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants