question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown: clicking outside vs. closing behavior

See original GitHub issue

Issue 1

  • Steps: Click on the dropdown then outside.
  • Expected Result: No option selected. Works if we close instead of clicking outside.
  • Actual Result: First option selected.

Issue 2

  • Steps: Select Item B then search for Item D (no results). Close dropdown (do not click outside).
  • Expected Result: Item B displayed.
  • Actual Result: Item D displayed. Item B is displayed back if we click outside instead.

Issue 3

  • Steps: Select Item B then search for Item D (no results). Click outside, open the dropdown and click outside once more.
  • Expected Result: Item B selected.
  • Actual Result: Item A selected.

Version

0.73.0

Testcases

https://codepen.io/anon/pen/JrdwxW

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
jducasse-consolecommented, Sep 18, 2017

Does selectOnBlur={false} do the trick?

0reactions
layershiftercommented, Aug 18, 2020

Issue 2

  • Steps: Select Item B then search for Item D (no results). Close dropdown (do not click outside).
  • Expected Result: Item B displayed.
  • Actual Result: Item D displayed. Item B is displayed back if we click outside instead.

This issue is still present the latest actual release.


0.73.0

index-0730

1.2.0

index-120

https://codesandbox.io/s/cool-bose-xwn7m?file=/example.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoid dropdown close on clicking outside - Stack Overflow
This dropdown will only close when the button is clicked. In some cases, you may want the Dropdown to close when the button...
Read more >
How to avoid dropdown menu to close menu items on clicking ...
The default behavior of a dropdown menu is to close the menu list items when clicked ... Closes the menu in the event...
Read more >
Click in dropdown closes the Drawer - Telerik UI for Blazor
When I click in the dropdown to select an item, the Drawer closes. Click and drag the scrollbar in the dropdown also closes...
Read more >
Best practices for handling clicks outside element
I suggest you to add an addition event listener touchend@window->dropdown#hide to catch outside clicks on some mobile devices. 2 Likes.
Read more >
Should clicking a drop-down menu in a native app a second ...
You can have other behaviors like, closing on losing focus or closing when clicked out of bounds. The clicking to close menu acts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found