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.

Feature/ dropdown close onBlur

See original GitHub issue

Issue description

  • components: Dropdown

It would be sweet to add closeOnBlur prop to dropdown.

The result:

If closeOnBlur={false} user my trigger dropdown toggle to close dropdown.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TheSharpieOnecommented, Feb 1, 2018

keyup happens when there is something else on the page which can be focused, allowing <kbd>tab</kbd> to blur and trigger toggle. The event target may also give some insight. https://stackblitz.com/edit/reactstrap-v5-beta-starter-7mgu2c?file=index.js

0reactions
supergibbscommented, Feb 1, 2018

Slick, using that logic you could not close the dropdown. If added to reactstrap, should probably just be added to the UncontrolledDropdown.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to hide a dropdown when the user clicks outside of it
If I use onblur , it successfully hides the dropdown, but if you click on an option it doesn't populate the input, this...
Read more >
option for manually closing dropdown menu when onBlur #1615
Is it possible to have a function to allow user manually closing the dropdown instead of closing it automatically when blurring?
Read more >
React Dropdown (onBlur) - CodePen
This example uses an XML-like syntax called JSX. Input data that is passed into the component can be accessed by render() via this.props....
Read more >
Element: blur event - Web APIs | MDN
The blur event fires when an element has lost focus. The event does not bubble, but the related focusout event that follows does...
Read more >
Dismissing a React Dropdown Menu by Clicking Outside its ...
The onBlur callback is called only after the dropdown menu gets the focus. If the action of clicking outside the component occurs before...
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