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

Close dropdown when clicking on select #211

Closed
MaaikeB opened this issue May 27, 2015 · 9 comments
Closed

Close dropdown when clicking on select #211

MaaikeB opened this issue May 27, 2015 · 9 comments

Comments

@MaaikeB
Copy link

MaaikeB commented May 27, 2015

right now the dropdown only closes when clicking somewhere outside of the select-control.
so: the user opens the dropdown by clicking on the select element, but has to move the mouse outside the element in order to close it (if he doesn't want to select any of the options)

it would be nice to add functionality so the dropdown opens when clicking on the select-control, and closes when clicking on it while the dropdown is open

@nkbt
Copy link
Contributor

nkbt commented Jun 10, 2015

Clicking on the select itself should not close menu (only focus cursor inside the input), here is a solution - click on arrow should close menu.

JedWatson added a commit that referenced this issue Jun 10, 2015
 Close dropdown when clicking on select #211
@JedWatson
Copy link
Owner

I agree with @nkbt, that seems like the correct behaviour. Otherwise placing the cursor at a different point in the text (with the mouse) would also close the menu, which would be unexpected.

If there's strong disagreement let me know and we can reopen the issue for discussion.

@raulmatei
Copy link

Hi guys, I feel I should add my input on this too. My opinion is that for non-searchable version it should have the HTML <select/> behavior, which is closing the dropdown when user clicks on the select-control and probably, for the searchable version it should close when clicking on the arrow.

@nkbt
Copy link
Contributor

nkbt commented Jun 10, 2015

@raulmatei that totally makes sense. I am going to update component to support this behavior.

@brianreavis
Copy link
Collaborator

for the searchable version, it should close when clicking on the arrow.

On this I disagree, for the the same reason that clicking a textbox shouldn't remove its focus.

@MaaikeB
Copy link
Author

MaaikeB commented Jun 10, 2015

created PR #243 with suggested fix for this issue
for searchable select elements the feature will not apply.

@raulmatei
Copy link

@brianreavis - I understand your point, but isn't the arrow indicating that you can hide/close the dropdown by clicking on it (without losing the focus on the select-control input element)?

@nkbt
Copy link
Contributor

nkbt commented Jun 10, 2015

That seems like a usual behavior of <select>. if you click on the input itself (not only the arrow) - it will toggle popout. So this additional PR looks fair.

JedWatson added a commit that referenced this issue Aug 12, 2015
proposed fix #211 - close dropdown when clicking on select
@JedWatson
Copy link
Owner

Sorry I left this for so long - fell completely off my radar. I agree this behaviour makes sense when the select is not searchable, so I've merged #243 and will release a patch soon.

bruderstein added a commit that referenced this issue Aug 12, 2015
Menu is closed after a selection is clicked from PR #243 (fix for issue #211)
Tests changed to re-open menu when selecting multiple items via mouse
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

6 participants