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

[Dropdown] 'clearable' setting - clears all the values across a class of dropdowns #6617

Open
cwalor opened this issue Oct 12, 2018 · 6 comments

Comments

@cwalor
Copy link

cwalor commented Oct 12, 2018

I use a lot of dropdown classes and stub the items list in Javascript. Allows me to mgt one listing that affects many similar dropdowns across my website. ie. list of states for example. The new 'clearable' setting is really nice because it allows me to clean up the interface and drop the -select- as a first line item etc. Unfortunately, clicking the 'clear' icon deletes values across the whole class of dropdowns. Hoping this feature could be initialized by class but the 'clearable' click be tied to an individual element/id. Thank you.

@ColinFrick
Copy link

Can you create a JSFiddle to replicate the issue?

@cwalor
Copy link
Author

cwalor commented Oct 12, 2018

https://jsfiddle.net/ca0rovs3/1191/#&togetherjs=9vdj8H0MkJ

Ok. fiddle created. Never done this before so hope you can see it.

In creating the fiddle I discovered some additional insight. It seems that enabling the 'on:hover' setting when initializing the dropdown is the root to the issue. My site has lots of data entry so saving a user an extra click to open up a dropdown is a big deal. The minimized code I created for the fiddle reacted differently than in my website which got me into looking into why. It seems that if the dropdown is wrapped in a Semantic UI form class (i.e ui form) the whole form is cleared when clicking on any one of the dropdown 'clear' icons. If the .ui.form class is removed then a click doesn't have any affect on the target dropdown (an obviously none of the other fields are affected either).

The fiddle i created was the worse case scenario where clearing a target dropdown clears out all the fields in the form.

Hope this helps. Thanks.

Btw, tested both scenarios without the 'hover on' enabled and both senarios worked as expected.

@cwalor
Copy link
Author

cwalor commented Oct 13, 2018 via email

@ColinFrick
Copy link

@cwalor I have and just looked into it. The problem is connected to #6594
In case of on: 'hover' there is no click listener attached to the clear icon, as a result the click event bubbles to the form, and the form listens on click events on any elements with the clear class therefore clears the form.

@cwalor
Copy link
Author

cwalor commented Oct 13, 2018 via email

y0hami pushed a commit to fomantic/Fomantic-UI that referenced this issue Oct 15, 2018
attach 'click' event to clear icon independent of the on option

closes #171 / Semantic-Org/Semantic-UI#6617 / Semantic-Org/Semantic-UI#6594
y0hami pushed a commit to fomantic/Fomantic-UI that referenced this issue Oct 15, 2018
attach 'click' event to clear icon independent of the on option

closes #171 / Semantic-Org/Semantic-UI#6617 / Semantic-Org/Semantic-UI#6594
@lubber-de

This comment was marked as spam.

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

3 participants