DropdownItem still not working
See original GitHub issueIssue description
- components:
DropdownItem
- reactstrap version
5.0.0-alpha.4
- import method
umd/csj/es
(if umd, are you using the “full” version (only for v5+)?) - react version
#16.2.0
- bootstrap version
#4.0.0-beta.3
What is happening?
The inner functions are not responding, however it does toggle off
What should be happening?
It should run the inner function first then toggle off
Steps to reproduce issue
- …
- …
Error message in console
No errors
paste error message with stacktrack here
Code
<Dropdown className="float-left p-0 dropdown-header" isOpen={isOpenImage} toggle={this.toggleImageMenu}>
<DropdownToggle nav>
<img className="rounded-circle float-left mr-1" src={`${user && user.user_image ? user.user_image : ''}`} height={40} width={40} alt="" />
</DropdownToggle>
<div style={{top: '50px', position: 'relative'}}>
<DropdownMenu>
<DropdownItem onClick={() => console.log('WORKS')}>
<div className="h-100 w-100" onClick={() => console.log('MAYBE')}>
Logout
</div>
</DropdownItem>
</DropdownMenu>
</div>
</Dropdown>
I know you’ve had a lot of duplicates on this issue but it’s still not working. Any help would be greatly appreciated
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Bootstrap dropdown not working - Stack Overflow
This fixed my issue. My angular app was pulling in multiple copies of bootstrap through the gulp task to inject my bower_components.
Read more >[Solved]-Bootstrap dropdown not working - Studytonight
Here we have listed out the reasons why the dropdown is not working and also added the solution to make it workable using...
Read more >dropdown item coloring not working - MDBootstrap
Hi,. I am using MDB 4.4 beta and I am trying a simple navbar dropdown example but the items change text color to...
Read more >Dropdowns · Bootstrap v5.0
They're toggled by clicking, not by hovering; this is an intentional design ... such as the ability to move through individual .dropdown-item elements...
Read more >Problem selecting SAP Web UI hover dropdown item - Activities
We have an SAP Webportal and i want some topic related to timesheet bookings. For this purpose i have to click a a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am also having this issue. Either fix it or remove the Button Dropdown from the docs. This is wasting peoples time.
I am not sure I understand the issue, but from what I can tell, the issue is not with reactstrap, but with the user’s code. The onClick events fire as you should expect them to.
I took the code in the original post and only added the missing method (
toggleImageMenu
) and state management (defaulting state and usingthis.state.isOpenImage
instead of justisOpenImage
from the component in the sample code provided (I also changed theimg
’ssrc
)As you can see, the onClick events happen and in the order one would expect, the inner most element is triggered and the outer one is called afterwards. Finally the toggle is called.
https://stackblitz.com/edit/reactstrap-v5a4-starter-5ytga5?file=Example.js