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 does not autoclose, throwing: Object doesn't support property or method 'closest'

See original GitHub issue

Bug description:

When I open a dropdown with autoclose and then click on the scrollbar in edge, an error is thrown in the console. It throws the error Object doesn't support property or method 'closest'. It is thrown because the element in event.target is HTMLDocument which does not support the closest method.

Link to minimally-working StackBlitz that reproduces the issue:

StackBlitz: https://angular-dpdswh-r6tj5y.stackblitz.io

  1. Open the StackBlitz in Edge 44.18362.449.0.
  2. Open the dropdown by clicking on it. Click on the scrollbar.
  3. The dropdown does not close. An error is thrown in the console.

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 8.2.13

ng-bootstrap: 4.2.2

Bootstrap: 4.3.1

Browser: Edge 44.18362.449.0, EdgeHTML 18.18362

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Istanfulcommented, Jun 25, 2020

@benouat Cool! I will make an attempt on a PR if you don’t get to it first. 😃

0reactions
Istanfulcommented, Jun 26, 2020

@benouat I made a pull request for this. The only different is that closest returns null for document. Apart from the automatic tests I tested in 44.18362.449.0, Safari 14609.2.9.1.3 and Chrome 83.0.4103.106. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dropdown Javascript error: object doesn't support property or ...
It looks like you try to check if the click event was triggered by an object with the class dropbtn. If you use...
Read more >
Object Doesn't Support this Property or Method - Microsoft Learn
The "object doesn't support this property or method" error occurs when you try to use a method or property that the specified object...
Read more >
Migration Guide | Cypress Documentation
Migrating to Cypress 12.0 This guide details the changes and how to change your code to migrate to Cypress version 12.0.
Read more >
Unity 2019.1.0a9
Editor: PostProcessing throws errors and tutorials do not start when Learn project is launched (1046727). iOS: Empty project build crashes ...
Read more >
Object doesnt support property or method dialog in ASP.Net
When i add a new javascript source to my popup modal page my modal is not appearing. If i remove the above script...
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