Browse Source

Remove animation on dropdown

This also removes the attempt to close the dropdown if you the toggle
again while it's already open, since it seems like that isn't working
correctly anyway.
merge-requests/88/head
Deimos 5 years ago
parent
commit
ed2cdd2c4b
  1. 8
      tildes/scss/modules/_dropdown.scss
  2. 1
      tildes/scss/styles.scss
  3. 5
      tildes/static/js/behaviors/dropdown-toggle.js

8
tildes/scss/modules/_dropdown.scss

@ -0,0 +1,8 @@
// Copyright (c) 2020 Tildes contributors <code@tildes.net>
// SPDX-License-Identifier: AGPL-3.0-or-later
.dropdown {
.menu {
animation: none;
}
}

1
tildes/scss/styles.scss

@ -15,6 +15,7 @@
@import "modules/comment"; @import "modules/comment";
@import "modules/divider"; @import "modules/divider";
@import "modules/donation"; @import "modules/donation";
@import "modules/dropdown";
@import "modules/empty"; @import "modules/empty";
@import "modules/form"; @import "modules/form";
@import "modules/group"; @import "modules/group";

5
tildes/static/js/behaviors/dropdown-toggle.js

@ -6,16 +6,11 @@
// with the dropdown-toggle class so that this behavior is always applied to dropdowns. // with the dropdown-toggle class so that this behavior is always applied to dropdowns.
$.onmount(".dropdown-toggle", function() { $.onmount(".dropdown-toggle", function() {
$(this).click(function() { $(this).click(function() {
if ($(this).is(":focus")) {
// If the button was already focused (so the menu is visible), close it
$(this).blur();
} else {
// Spectre.css's dropdown menus use the focus event to display the menu, // Spectre.css's dropdown menus use the focus event to display the menu,
// but Safari and Firefox on OSX don't give focus to a <button> when it's // but Safari and Firefox on OSX don't give focus to a <button> when it's
// clicked. More info: // clicked. More info:
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
// This should make the behavior consistent across all browsers // This should make the behavior consistent across all browsers
$(this).focus(); $(this).focus();
}
}); });
}); });
Loading…
Cancel
Save