Skip to content

How open the dropdown without the 1st option already being active? #330

Answered by coudrak
coudrak asked this question in Q&A
Discussion options

You must be logged in to vote

It's ok I found I needed to use hook('after', 'refreshOptions').

I did a plugin to keep the dropdown always open, if anyone is interested, here the code:
(demo on my website https://www.partenairesport.fr/inscription.html (the sport list) )

	function keep_open () {
	  var self = this;
	  let first = true;
	  
	  function removeActive() {
		  let sel = self.dropdown_content.querySelector('.active');
		  if (sel !== null) {
			  sel.removeAttribute('arial-selected');
			  sel.classList.remove('active');
		  }
	  }
		
	  const orig_onBlur = self.onBlur;
	  this.hook('instead', 'onBlur', evt => {
		  removeActive();
		  return;
	  });
	  
	  this.hook('instead', 'onClick', evt => {
	      sel…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by coudrak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant