electron-notifications icon indicating copy to clipboard operation
electron-notifications copied to clipboard

'clicked' Event not working

Open agriguol opened this issue 7 years ago • 19 comments

Hello! I am working electron-notifications but 'clicked' and 'swipeRight' not working.

notification.on('clicked', () => { console.log("Clicked"); notification.close(); })

agriguol avatar Mar 01 '17 21:03 agriguol

From the documentation:

notification.on('buttonClicked', (text) => {
  if (text === 'Snooze') {
    // Snooze!
  }
  notification.close()
})

Note the use of 'buttonClicked' as opposed to 'clicked' you are using. Does that resolve it?

swipeRight should be swipedRight (with a 'd')

Nantris avatar Mar 01 '17 22:03 Nantris

I've had the same problem on windows 7, 'clicked' doesn't seem to work but 'buttonClicked' does.

cgerikj avatar Mar 02 '17 09:03 cgerikj

The event buttonClicked works, but 'clicked' does not work. I need to make click in the notification without buttons.

agriguol avatar Mar 02 '17 12:03 agriguol

@agriguol if you run the playbook does the click example work?

bayleedev avatar Mar 02 '17 16:03 bayleedev

@blainesch - 'clicked' event does not work with playbook.

You must to correct the 'swipedEvent' event (with a 'd') in the playbook.

agriguol avatar Mar 02 '17 17:03 agriguol

@agriguol fixed with 78955ab868989529731bdfc45d4075450fe9f2ce

Can you give me some details to help me reproduce this?

  • Operating system
  • node version
  • any errors in the console you are getting

bayleedev avatar Mar 02 '17 18:03 bayleedev

Operating system : Windows 10 Home Version 1511 node version: v6.9.5 npm version: 3.10.10 any errors in the console you are getting : no errors

agriguol avatar Mar 02 '17 18:03 agriguol

I think I have reproduced this on a VM, but I'm having issues getting devtools open on the notification. I'll play around with this later tonight. Thanks for reporting it!

bayleedev avatar Mar 02 '17 21:03 bayleedev

I am able to consistently get devTools with

Updating windowOptions to:

let windowOptions = {
      width: 400,
      height: this.notificationHeight + verticalSpace,
      x: size.width - 400,
      y: 0,  /* this is because we set the poper position when we pop it from the queue */
      frame: true,
      resizable: true,
      alwaysOnTop: true,
      skipTaskbar: true,
      webPreferences: {
        devTools: true,
      },
      focusable: true,
    };

and adding

notificationWindow.openDevTools(); after notificationWindow.loadURL()

Not sure if you're having a general problem with devTools or just a specific one in that case. Hope this helps.

Nantris avatar Mar 05 '17 19:03 Nantris

I can re-produce it with palybook on windows 7

afriedma avatar Mar 10 '17 14:03 afriedma

Any plans on merging this fix?

afriedma avatar Mar 15 '17 15:03 afriedma

@afriedma I have not found a way to fix this yet.

bayleedev avatar Mar 19 '17 05:03 bayleedev

I'm not clear on the issue here. Is it that we want to add a 'clicked' listener to the entire notification?

Nantris avatar Mar 19 '17 13:03 Nantris

Yes, it used to work fine. Any clues, I can help out if you needed.

afriedma avatar Mar 19 '17 18:03 afriedma

@afriedma it's odd it would just stop, the behavior file hasn't been modified since it was created. The only thing that's changed recently was some css :/

bayleedev avatar Mar 19 '17 19:03 bayleedev

May be because you made the browser window same size as HTML div? Click is not being propogated?

Cheers, Alex


From: Blaine Schmeisser [email protected] Sent: Sunday, March 19, 2017 3:10:21 PM To: blainesch/electron-notifications Cc: afriedma; Mention Subject: Re: [blainesch/electron-notifications] 'clicked' Event not working (#24)

@afriedmahttps://github.com/afriedma it's odd it would just stop, the behavior file hasn't been modified since it was created. The only thing that's changed recently was some css :/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/blainesch/electron-notifications/issues/24#issuecomment-287639272, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AV7wm32vQHnZ1WWOLDubwY6U3k35UK69ks5rnX2dgaJpZM4MQNiV.

afriedma avatar Mar 19 '17 19:03 afriedma

What element was the clicked listener attached to? Is it possible that another element is overlayed on top of the one you are trying to listen for clicks on?

For example, I noticed that the title has a ::before element which covers it, which was preventing me from listening for clicks on that element.

Nantris avatar Mar 19 '17 19:03 Nantris

On my VM I looked at every major version with a playbook (v0.1.0 and higher) and none of them appear to work on Windows with the click event, so this isn't a regression.

bayleedev avatar Mar 19 '17 19:03 bayleedev

I just did some testing too, @blainesch you are correct, click event doesn't work on windows.

afriedma avatar Mar 20 '17 14:03 afriedma