Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Escape Key Listener Already Exists Error When Opening Multiple Dialogs #5767

Closed
ahmet-cetinkaya opened this issue Jan 14, 2024 · 17 comments · Fixed by #5770
Closed

Global Escape Key Listener Already Exists Error When Opening Multiple Dialogs #5767

ahmet-cetinkaya opened this issue Jan 14, 2024 · 17 comments · Fixed by #5770
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@ahmet-cetinkaya
Copy link

Describe the bug

When attempting to open multiple instances of the dialog component simultaneously, the application encounters the following error: global esc key listener with priority [300, undefined] already exists. This error disrupts the expected functionality of the dialog component and prevents the proper handling of multiple instances.

Reproducer

https://stackblitz.com/edit/173pfv?file=src%2FApp.jsx

PrimeReact version

10.3.1

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Firefox Develeper Edition 122.0b9, Brave 1.61.116 Chromium: 120.0.6099.217

Steps to reproduce the behavior

  1. Add dialog components then more one
  2. Add a button to open multiple dialog
  3. Click open button
  4. See error on console

Expected behavior

I expected the application to handle multiple dialog instances gracefully without encountering any errors. At least when the closeOnEscape property is false, it shouldn't be a problem.

@ahmet-cetinkaya ahmet-cetinkaya added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 14, 2024
@melloware
Copy link
Member

Thanks for the reproducer I will investigate.

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 14, 2024
@melloware melloware added this to the 10.4.0 milestone Jan 14, 2024
@melloware melloware self-assigned this Jan 14, 2024
melloware added a commit to melloware/primereact that referenced this issue Jan 15, 2024
@melloware
Copy link
Member

@ahmet-cetinkaya 10.3.2 is out if you would like to try and report back.

@enzolry
Copy link

enzolry commented Feb 27, 2024

For me, the error started appearing randomly after upgrading from 10.0.X to 10.5.1.

@melloware
Copy link
Member

@enzolry we have a fix upcoming for 10.5.2: #6000

@bloodykheeng
Copy link

bloodykheeng commented Sep 30, 2024

@melloware issue is still there prime react 10.6.6 . i was using the image component with a preview on a map marker (leaflet js) but i noted when i click on a map marker it opens a popup where i display the primereact image component and the primereact image component has preview enabled .

preview works when my map is not in full screeen but when i put it in full screen i get error. So the problem happens when i try to preview image when ive opened the map in full screen

am using this to show map in full screen
import "leaflet-fullscreen";
import "leaflet-fullscreen/dist/Leaflet.fullscreen.js";
import "leaflet-fullscreen/dist/leaflet.fullscreen.css";

what i noted the maps z index is greater than the image preview z index so the image shows behind the map when am in the maps view full screen and when i try to preview the image in full screen and so the image previews but it comes behind the map

so when i try to open another image when the first image is still open behind the map i get this error

Unexpected: global esc key listener with priority [400, 0] already exists.
at Object.addListener (http://localhost:3000/static/js/bundle.js:342549:13)
at http://localhost:3000/static/js/bundle.js:342570:38
at commitHookEffectListMount (http://localhost:3000/static/js/bundle.js:408788:30)
at commitPassiveMountOnFiber

i need some help here how can i set the image preview zIndex such that i make it greater than the map am using leaflet for my maps

@melloware
Copy link
Member

@bloodykheeng might need a fix similar to this one: #7228

@bloodykheeng
Copy link

@melloware isuue still exits on Image component with preview

@melloware
Copy link
Member

See my comment above i think its needs a bug fix similar to #7228

@bloodykheeng
Copy link

@melloware im still facing challenge here ok i replaced image in now am using a diaglog to preview it but still the diaglog comes behind the map even if i set th diaglog zIndex to 300000000 millions still its behind the map i dono why

This behaviour happens when i view the map in full screen

import "leaflet-fullscreen";
import "leaflet-fullscreen/dist/Leaflet.fullscreen.js";
import "leaflet-fullscreen/dist/leaflet.fullscreen.css";

@melloware
Copy link
Member

melloware commented Sep 30, 2024

Honestly its most likely Leaflet related and you will have to study it. It may not even be a z-Index issue it may be something special Leaflet is doing...

Especially import "leaflet-fullscreen/dist/leaflet.fullscreen.css"; since FullScreen MEANS fullscreen.

@bloodykheeng
Copy link

@melloware the link ur giving me its showing fixes made on calender component am taking about Image component
import { Image } from 'primereact/image';

https://primereact.org/image/

@melloware
Copy link
Member

@bloodykheeng yes I am saying that bug has the same "duplicate" error you are reporting. It looks like it was fixed for Calendar I am saying it sounds like a SIMILAR fix will be need to be made for this issue. "global esc key listener with priority [400, 0] already exists." is the same error that Calendar was getting.

@bloodykheeng
Copy link

ok cool i get it then @melloware

But incase u have any idea or solution on how i can be able to show the diaglog infront of the react leaflet map in full screen
please u can notify me

@melloware
Copy link
Member

Nope as i mentioned you can see its a Leaflet issue: Leaflet/Leaflet.fullscreen#113

Forget React its just a problem with how they do their fullscreen mode.

@bloodykheeng
Copy link

ok then @melloware lemi try to look into leaflet full screen css

@eliashetland
Copy link

i get the error

global esc key listener with priority [600, 0] already exists.

when using two calendars with showtime, timeonly. To replicate open one of the calendars, change time, and then click on the other calendar
image

@melloware
Copy link
Member

@eliashetland already fixed for next release: #7220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants