Skip to content

Commit

Permalink
Esri#953 - fix modal toggles when toggle has child element
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcpederson committed Aug 4, 2018
1 parent 2a47259 commit 2f184dd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@
- fix diacritical marks in Hebrew (#966)
- allow override of `$vw-ratio` variable (#960)
- use `$dark-green` for green labels to pass WCAG 2.0 AA requirements (#969)
- fix modal toggles when toggle has child element (#953)

## [1.0.2][1.0.2]

Expand Down
Expand Up @@ -42,5 +42,5 @@ <h3 class='trailer-half'>Another Modal!</h3>
</div>
</div>

<a class="js-modal-toggle btn" href="#" data-modal="foo">Show Modal</a>
<a class="js-modal-toggle btn" href="#" data-modal="foo"><span>Show Modal</span></a>
<a class="js-modal-toggle btn" href="#" data-modal="baz">Show Another Modal</a>
3 changes: 2 additions & 1 deletion lib/js/patterns/modal.js
Expand Up @@ -113,7 +113,8 @@ function modal () {

function toggleClick (e) {
event.preventDefault(e);
var modalId = e.target.getAttribute('data-modal');
var toggle = dom.closest('js-modal-toggle', e.target);
var modalId = toggle.getAttribute('data-modal');
bus.emit('modal:open', {id: modalId});
}

Expand Down

0 comments on commit 2f184dd

Please sign in to comment.