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

modals are not working with <area> links #18796

Closed
tgirod opened this issue Jan 7, 2016 · 6 comments
Closed

modals are not working with <area> links #18796

tgirod opened this issue Jan 7, 2016 · 6 comments

Comments

@tgirod
Copy link

tgirod commented Jan 7, 2016

From the documentation on modals: http://getbootstrap.com/javascript/#modals-options

Adding a href attribute pointing to a page will load the page's content inside .modal-content. It works for a regular link, it works for a button, but it doesn't work for a <area> link.

<area shape="poly" coords="..." data-toggle="modal" data-target="#modal">

This will toggle my #modal display with its default content.

<area shape="poly" coords="..." data-toggle="modal" data-target="#modal" href="remote.html">

Won't toggle my modal display but simply follow the link instead.

@mdo
Copy link
Member

mdo commented Jan 7, 2016

Never used an area element myself. Can you create a JS Bin or JS Fiddle example?

@tgirod
Copy link
Author

tgirod commented Jan 8, 2016

Well, this is weird. this jsfiddle (my first one, maybe I'm doing something wrong) does reproduce the bug, but the proper link, which should load the remote content inside the modal doesn't work either, even though it worked yesterday on my project.

Well, at least you have the <area> code you can copy-paste if you want to try locally ... I hope it will help !

@cvrebert
Copy link
Collaborator

The code currently only prevents the default action (navigating to the link target) for <a> tags.
See

if ($this.is('a')) e.preventDefault()

Presumably we should add <area> to that if.

@cvrebert
Copy link
Collaborator

v4 is also affected:

if (this.tagName === 'A') {

@cvrebert cvrebert added the v4 label Jan 10, 2016
@mishra-ankit
Copy link

Updating if sounds good to me, I can go ahead with the change if the approach is confirmed.

@cvrebert cvrebert changed the title modals with remote content are not working with <area> links modals are not working with <area> links Feb 2, 2016
@cvrebert
Copy link
Collaborator

cvrebert commented Feb 2, 2016

@mishra-ankit Go for it. 😄 You will also need to add a testcase to the test suite; see https://github.com/twbs/bootstrap/tree/v4-dev/js/tests for info on how to do that.

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

4 participants