{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/framework/issues/848","repository_url":"https://api.github.com/repos/aurelia/framework","labels_url":"https://api.github.com/repos/aurelia/framework/issues/848/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/framework/issues/848/comments","events_url":"https://api.github.com/repos/aurelia/framework/issues/848/events","html_url":"https://github.com/aurelia/framework/issues/848","id":286579112,"node_id":"MDU6SXNzdWUyODY1NzkxMTI=","number":848,"title":"Unable to preventDefault on route-href when pushState is true","user":{"login":"powerbuoy","id":1027780,"node_id":"MDQ6VXNlcjEwMjc3ODA=","avatar_url":"https://avatars3.githubusercontent.com/u/1027780?v=4","gravatar_id":"","url":"https://api.github.com/users/powerbuoy","html_url":"https://github.com/powerbuoy","followers_url":"https://api.github.com/users/powerbuoy/followers","following_url":"https://api.github.com/users/powerbuoy/following{/other_user}","gists_url":"https://api.github.com/users/powerbuoy/gists{/gist_id}","starred_url":"https://api.github.com/users/powerbuoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerbuoy/subscriptions","organizations_url":"https://api.github.com/users/powerbuoy/orgs","repos_url":"https://api.github.com/users/powerbuoy/repos","events_url":"https://api.github.com/users/powerbuoy/events{/privacy}","received_events_url":"https://api.github.com/users/powerbuoy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-01-07T15:59:41Z","updated_at":"2018-11-13T09:35:05Z","closed_at":null,"author_association":"NONE","body":"I'm trying to prevent a link with a `route-href` attribute from navigating to the new URL.\r\n\r\nWhen I configure the router to use `hashChange` instead of `pushState` it works fine. But if I switch to `pushState` `preventDefault()` does nothing:\r\n\r\n```js\r\nimport {inject} from 'aurelia-framework';\r\n\r\n@inject(Element)\r\nexport class PreventHrefCustomAttribute {\r\n\tconstructor (el) {\r\n\t\tthis.el = el;\r\n\t\tthis.onClick = e => {\r\n\t\t\te.preventDefault(); // This only works when pushState: false, hashChange: true\r\n\r\n\t\t\talert('The href should not be followed');\r\n\t\t};\r\n\t}\r\n\r\n\tattached () {\r\n\t\tthis.el.addEventListener('click', this.onClick);\r\n\t}\r\n\r\n\tdetached () {\r\n\t\tthis.el.removeEventListener('click', this.onClick);\r\n\t}\r\n}\r\n```\r\n\r\n`<a route-href=\"route: item; params.bind: {id: item.id}\" prevent-href>${item.name}</a>`\r\n  "},"comment":{"url":"https://api.github.com/repos/aurelia/framework/issues/comments/438198951","html_url":"https://github.com/aurelia/framework/issues/848#issuecomment-438198951","issue_url":"https://api.github.com/repos/aurelia/framework/issues/848","id":438198951,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODE5ODk1MQ==","user":{"login":"powerbuoy","id":1027780,"node_id":"MDQ6VXNlcjEwMjc3ODA=","avatar_url":"https://avatars3.githubusercontent.com/u/1027780?v=4","gravatar_id":"","url":"https://api.github.com/users/powerbuoy","html_url":"https://github.com/powerbuoy","followers_url":"https://api.github.com/users/powerbuoy/followers","following_url":"https://api.github.com/users/powerbuoy/following{/other_user}","gists_url":"https://api.github.com/users/powerbuoy/gists{/gist_id}","starred_url":"https://api.github.com/users/powerbuoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerbuoy/subscriptions","organizations_url":"https://api.github.com/users/powerbuoy/orgs","repos_url":"https://api.github.com/users/powerbuoy/repos","events_url":"https://api.github.com/users/powerbuoy/events{/privacy}","received_events_url":"https://api.github.com/users/powerbuoy/received_events","type":"User","site_admin":false},"created_at":"2018-11-13T09:35:05Z","updated_at":"2018-11-13T09:35:05Z","author_association":"NONE","body":"@bigopon I don't want the router to ignore it though. Most of the time I want the `route-href` to work as it should, and then in some cases I want my custom `route-popup` attribute to take over and open the route in a popup instead (think Pinterest where each post has its own page/URL but they open in popups on the home-page in high res screens).\r\n\r\nTo be the fact that it works when `pushState: false` sounds like a bug."}}
{"actor":{"display_login":"powerbuoy"}}