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.

not working properly with 'addEventListner'

See original GitHub issue

since 0.2.0 driver.js was not working to be properly with addEventLister method, just blinking.

I tested with Firefox and Google Chorme on Mac, either same results…

var driver = new Driver();
document.getElementById('btn1')
        .addEventListener('click', function(event) {
  
    driver.highlight({
      element: '#form1',
      popover: {
        title: 'Title for the Popover',
        description: 'Description for it',
      }
    });
});

abcdd

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
kamranahmedsecommented, Mar 14, 2018

Hey @kei0719 you need to add event.stopPropagation() on the button click

var driver = new Driver();
document.getElementById('btn1')
        .addEventListener('click', function(event) {
    event.stopPropagation();

    driver.highlight({
      element: '#form1',
      popover: {
        title: 'Title for the Popover',
        description: 'Description for it',
      }
    });
});

Also, it is obvious but, if the button is anchor with href="#"', you may also have to do event.preventDefault() to make the page not scroll to top

0reactions
kamranahmedsecommented, Mar 22, 2018

Hey, yes it is mentioned in the readme also, you need to add that. It is how the driver is implemented. Since the element is located out of the element to be highlighted, clicking this displays the overlay and immediately catches this click event if you don’t use e.stopPropagation() and clears it. I need to handle it better but for now, you need to add this

Read more comments on GitHub >

github_iconTop Results From Across the Web

addEventListener not working in javascript - Stack Overflow
I am learning addEventListener,I was testing one of the example but its not working .Can anybody tell me what i am doing wrong...
Read more >
Event listeners not working? 3 key areas to troubleshoot
If your event listener not working is dependent on some logic, whether it's about which element it'll listen on or if it's registered...
Read more >
addEventListener not working? Using exact example from ...
I am using the direct example for setting up Laravel Cashier using Laravel v6.8.0 and Cashier v10.5.1 For some reason addEventListener on the...
Read more >
[Solved]Why addEventListener not working? - Sololearn
[Solved]Why addEventListener not working? · + 8. You must apply any JS only after the page content is loaded. So you should put...
Read more >
addEventListener not working - The freeCodeCamp Forum
This is done in codepen so I didnt include and tags ,but the issue is I am not getting the return statement message...
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