Patternslib / Patterns

Library for quickly applying rich interaction patterns without the need to write any JavaScript.
http://patternslib.com
Other
104 stars 43 forks source link

pat-inject: Use ``history: record`` for each injection triggered by "click" events on "anchor" elements. #822

Open thet opened 3 years ago

thet commented 3 years ago

Often the history: record configuration isn't used when it should. This leads to changing pages without having the URLs changed in the browser bar. And this leads to some other problems, like a sidebar not being updated based on the state of the window.location object or the page not being bookmark/shareable because the window.location entry is wrong.

I think we can just use the history: record option by default for all injections triggered by a click event on a anchor element.

cornae commented 3 years ago

Changing that default will have unoversee-able consequences for al projects that use Patterns. The discussion has been held before and there has also been similar proposal https://github.com/Patternslib/Patterns/issues/703 there’s also https://github.com/Patternslib/Patterns/issues/684 which made place for CBS files https://github.com/Patternslib/Patterns/issues/748, which would solve the issue like this:

a {
  @pattern inject {
    history: record;
  }
}

I would rather propose to take this case as a test case for a small POC around the CBS concept rather than potentially disrupting a lot of projects.