Open
Description
What were you trying to do?
Toggle a <dialog>
element with a hot key or a menu click event.
This is a regular desktop and not a menubar app
What happened?
When I used a simple toggle on the dialog element, it never showed, after som debugging I realized that the event triggered twice, causing the toggle to close the dialog before it was visible.
How to reproduce the bug
In the NativeServiceProvider
add the following code.
Menu::create(
Menu::app('RecordCollector'),
Menu::file(),
Menu::make(
Menu::label('Add Artist')
->event(AddArtistEvent::class)
->hotkey('Alt+A'),
And then create the AddArtistEvent
event handler using php artisan
.
In the app.js
file add the following code
Native.on('App\\Events\\AddArtistEvent', (payload, event) => {
console.log('Triggering Event');
);
The result then look something like this.
Triggering Event
index.mjs:28 [info] Broadcasting [App\Events\AddArtistEvent] on channels [nativephp] with payload:
{
"item": {
"label": "Add Artist",
"checked": false
},
"combo": {
"shiftKey": false,
"ctrlKey": false,
"altKey": true,
"metaKey": false,
"triggeredByAccelerator": true
},
"socket": null
}
[]
app.js:34 Triggering Event
index.mjs:28 [info] Broadcasting [Native\Laravel\Events\Windows\WindowBlurred] on channels [nativephp] with payload:
{
"id": "main",
"socket": null
}
[]
Debug Output
Which operating systems have you seen this occur on?
macOS
Notes
No response