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

emptyMsg Shows on Resize When Using Custom Container #103

Closed
bcrotty opened this issue May 31, 2023 · 3 comments
Closed

emptyMsg Shows on Resize When Using Custom Container #103

bcrotty opened this issue May 31, 2023 · 3 comments

Comments

@bcrotty
Copy link

bcrotty commented May 31, 2023

Similar to #3, the emptyMsg shows when I resize the browser window if I specify my own container in the autocomplete settings. If I let it use the default generated container, the message does not appear on resize.

@kraaden
Copy link
Owner

kraaden commented Jul 22, 2023

Hi @bcrotty

Could you please provide a minimal reproducible example? I just tested autocomplete with a custom container and both suggestions and empty message are properly attached to my custom DOM container (both initially or while resizing).

@bcrotty
Copy link
Author

bcrotty commented Aug 21, 2023

Sorry for the delay. Here you go:

<!DOCTYPE html>
<html>
  <head>
    <script src="https://kraaden.github.io/autocomplete/autocomplete.js"></script>
  </head>
  <body>
    <div id="search-container">
      <input type="text" id="search" />
      <div id="search-results"></div>
    </div>
    <script>
      const input = document.getElementById("search");

      document.addEventListener("DOMContentLoaded", () => {
        autocomplete({
          input,
          emptyMsg: "No results found",
          container: document.getElementById("search-results"),
        });
      });
    </script>
  </body>
</html>

When I resize my browser when viewing that page, the emptyMsg text appears. Disabling the container parameter fixes the issue.

@kraaden
Copy link
Owner

kraaden commented Aug 23, 2023

@bcrotty I fixed the issue in the latest version

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

2 participants