Revert #3116 and fix #3076 by changing href="#" to href="javascript:void(0)" instead - fixes #3208

The stopPropagation() call was too eager, as this blocked legitimate clicks on the links in the 'more' dropdown.

Yes, I know javascript:void(0) is evil, but it's less evil than href="#" in that it doesn't have side effects. And if the design calls for an element that has the same styling and interactions as an `<a>` element but just happens to trigger an in-page action rather than navigating to a new URL, I don't see why I should jump through hoops undoing the native style of an alternative element like `<button>` to achieve something that's perfectly simple to do the 'evil' way, and as far as I'm aware has no negative effects other than to cause HTML purists to roll their eyes. SO THERE.
This commit is contained in:
Matt Westcott 2016-12-08 12:56:50 +00:00
parent a6dcd8e06b
commit d7f4dab1fa
2 changed files with 1 additions and 3 deletions

View file

@ -427,8 +427,6 @@ wagtail = (function(document, window, wagtail) {
_closeDropDown: function(e) {
this.state.isOpen = false;
e.stopPropagation();
e.preventDefault();
var el = this.el;
var $parent = this.$parent;

View file

@ -1,5 +1,5 @@
<div {{ self.attrs }} class="c-dropdown {% if is_parent %}t-inverted{% else %}t-default{% endif %}" data-dropdown>
<a href="#" title="{{ title }}" class="c-dropdown__button u-btn-current">
<a href="javascript:void(0)" title="{{ title }}" class="c-dropdown__button u-btn-current">
{{ label }}
<div data-dropdown-toggle class="o-icon c-dropdown__toggle [ icon icon-arrow-down ]"></div>
</a>