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

Handle click on element (e.g. <span>) within an anchor <a> #103

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@e2jk
Contributor

e2jk commented Feb 21, 2015

Without this addition, in the example below the element that is clicked is the span, thus it has no host property. The link is thus considered not to be local, meaning that app.navigate is not used and the browser sends a new GET request to the server.
Now if the element is not an anchor, it will check if the parent is one, and use that as the link instead.

<div class="list-group" data-hook="blabla-list">
    <a class="blabla list-group-item" data-hook="url" href="/some_url/1">
        <img height="40" width="40" data-hook="avatar" src="some image"></img>
        <span data-hook="name">Some text</span>
    </a>
[...]
Handle click on element (e.g. <span>) within an anchor <a>
Without this addition, in the example below the element that is clicked is the span, thus it has no `host` property. The link is thus considered not to be local, meaning that `app.navigate` is not used and the browser sends a new `GET` request to the server.
Now if the element is not an anchor, it will check if the parent is one, and use that as the link instead.

```
<div class="list-group" data-hook="blabla-list">
    <a class="blabla list-group-item" data-hook="url" href="/some_url/1">
        <img height="40" width="40" data-hook="avatar" src="some image"></img>
        <span data-hook="name">Some text</span>
    </a>
[...]
```

@bear bear added bug request labels Feb 22, 2015

@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Feb 24, 2015

Member

This'd take care of 1 level "deep" elements. What about those with more complex hierarchies and yet being a link? Think about "card tile" for example.

Member

kamilogorek commented Feb 24, 2015

This'd take care of 1 level "deep" elements. What about those with more complex hierarchies and yet being a link? Think about "card tile" for example.

@lukekarrys

This comment has been minimized.

Show comment
Hide comment
@lukekarrys

lukekarrys Feb 24, 2015

Contributor

I've solved this (and a few other element click quirks) in a separate module that we could include here: http://npmjs.org/local-links

I know @HenrikJoreteg has been using it for some stuff. Maybe he could chime in on whether it'd be a good candidate to use here?

Contributor

lukekarrys commented Feb 24, 2015

I've solved this (and a few other element click quirks) in a separate module that we could include here: http://npmjs.org/local-links

I know @HenrikJoreteg has been using it for some stuff. Maybe he could chime in on whether it'd be a good candidate to use here?

@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Feb 24, 2015

Member

Looks nice and should resolve this issue once and for all.

Member

kamilogorek commented Feb 24, 2015

Looks nice and should resolve this issue once and for all.

@lukekarrys

This comment has been minimized.

Show comment
Hide comment
@lukekarrys

lukekarrys Feb 24, 2015

Contributor

Looks like this was already fixed in the latest release: v3.0.0.

@e2jk You should be able to update the cli and it should work now.

Contributor

lukekarrys commented Feb 24, 2015

Looks like this was already fixed in the latest release: v3.0.0.

@e2jk You should be able to update the cli and it should work now.

@lukekarrys lukekarrys closed this Feb 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment