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

When openOnFocus: false dropdown still opens when clicking on selectize element #2176

Open
gadenbuie opened this issue Jan 27, 2025 · 0 comments

Comments

@gadenbuie
Copy link

With selectize v0.14.0, when initialized with openOnFocus: false, both tab-focus and clicking to focus on the selectize element would not open the dropdown menu.

With selectize v0.15.2 and openOnFocus: false, keyboard focus does not open the dropdown, but clicking does. If I understand the docs, the intention is that neither action should cause the the dropdown when openOnFocus: false.

I created a codepen the demonstrates the problem (change the selectize version to 0.14.0 to see the previous behavior). Here's a bare minimum version of the HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Selectize Demo</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.14.0/js/selectize.min.js"></script> -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js"></script>
  <style>
    select {
      width: 100%;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <h1>Selectize Demo</h1>
  <select id="select-books">
    <option value="">Select a book...</option>
    <option value="1984">1984 by George Orwell</option>
    <option value="brave-new-world">Brave New World by Aldous Huxley</option>
    <option value="fahrenheit-451">Fahrenheit 451 by Ray Bradbury</option>
    <option value="dune">Dune by Frank Herbert</option>
    <option value="foundation">Foundation by Isaac Asimov</option>
  </select>
  <script>
    $(document).ready(function () {
      $('#select-books').selectize({
        openOnFocus: false
      });
    });
  </script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant