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.

Prevent redundant keyup-listeners from being registered

See original GitHub issue

I’m submitting a feature request

[ ] bug report
[ x ] feature request
[ ] support request

Current behavior Currently, instantiating any ngx-smart-modal register a keyup listener on the document, this causes exponential performance issues when a modal appears in a looped component.

Yes, I am aware the solution for this is to treat a modal like a singleton and ensure it is only declared once but that is not the point here.

Expected behavior A listener should only be created when the corresponding config parameter requires it to be so. e.g. a ngx-smart-modal where escapable is false should not register a keyup listener on the document.

Reproduction of the problem

  • Two modals appear in my list of 139 items, 7 appear outside of the list: image

  • After removing both modals: image

What is the motivation / use case for changing the behavior? Behavior that is configured to be disabled should be completely disabled.

Please tell us about your environment: macOS High Sierra 10.13.6

  • Smart Modal version: 6.0.4

  • Angular version: 5.2.11

  • Browser: all

  • Language: Typescript

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mduran-nerdcommented, Sep 17, 2018

@maximelafarie I’ve submitted a PR that fixes this issue: https://github.com/biig-io/ngx-smart-modal/pull/141

Could you have a look?

1reaction
mduran-nerdcommented, Sep 4, 2018

@maximelafarie Do you have a planned date for the next release?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent my keyUp event listener from firing multiple ...
Change keyUp to keyup in your event listener, and it should work correctly. Stop the form from submitting by preventing that event:
Read more >
Addresses keyup Issue (#133) #141 - GitHub
Applies a keyup event listener only after the modal has opened. ... Prevent redundant keyup-listeners from being registered #133.
Read more >
Prevent duplicate Event bindings in jQuery | by Sky Bit - Medium
Prevent duplicate Event bindings in jQuery ... So, while you want the event to be registered once, get resulted in multiple registrations.
Read more >
Event Listeners in React Components - Pluralsight
You need to remove the event listener when the component is unmounted. To solve the first issue you will need to use the...
Read more >
EventTarget.addEventListener() - Web APIs | MDN
A boolean value indicating whether events of this type will be dispatched to the registered listener before being dispatched to any EventTarget ...
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