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.

DropdownItem still not working

See original GitHub issue

Issue 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:closed
  • Created 6 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
ravenbergcommented, Jan 24, 2018

I am also having this issue. Either fix it or remove the Button Dropdown from the docs. This is wasting peoples time.

3reactions
TheSharpieOnecommented, Jan 25, 2018

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 using this.state.isOpenImage instead of just isOpenImage from the component in the sample code provided (I also changed the img’s src)

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.

dropdown-triggers

https://stackblitz.com/edit/reactstrap-v5a4-starter-5ytga5?file=Example.js

Read more comments on GitHub >

github_iconTop 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 >

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