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

responsiveDropdown breaks the dropdown when the element is initially hidden #90

Open
makedin opened this issue Jan 13, 2022 · 0 comments

Comments

@makedin
Copy link

makedin commented Jan 13, 2022

When the responsiveDropdown option is true, the width of the dropdown for selecting countries is set to the element's offsetWidth:

if (this.options.responsiveDropdown) {                
      $(window).resize(function() {                
          $('.country-select').each(function() {                
          var dropdownWidth = this.offsetWidth;                
              $(this).find('.country-list').css("width", dropdownWidth + "px");                
          });                
      }).resize();                        
}                             

This works well when the element is visible when the code runs, but causes trouble when it's not: the offsetWidth is zero when the element is hidden (MDN). This in turn means that the dropdown's width get set to 0px, making for a suboptimal user experience.

I'm not sure how to go about properly fixing this, but perhaps there could at least be a minimum value greater than 0px for the dropdown's width?

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