bayleedev / electron-notifications

:boom: A node module for sending notifications in electron applications.
MIT License
133 stars 54 forks source link

'clicked' Event not working #24

Open agriguol opened 7 years ago

agriguol commented 7 years ago

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

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

Nantris commented 7 years ago

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')

cgerikj commented 7 years ago

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

agriguol commented 7 years ago

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

bayleedev commented 7 years ago

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

agriguol commented 7 years ago

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

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

bayleedev commented 7 years ago

@agriguol fixed with 78955ab868989529731bdfc45d4075450fe9f2ce

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

agriguol commented 7 years ago

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

bayleedev commented 7 years ago

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!

Nantris commented 7 years ago

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.

afriedma commented 7 years ago

I can re-produce it with palybook on windows 7

afriedma commented 7 years ago

Any plans on merging this fix?

bayleedev commented 7 years ago

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

Nantris commented 7 years ago

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

afriedma commented 7 years ago

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

bayleedev commented 7 years ago

@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 :/

afriedma commented 7 years ago

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

Cheers, Alex


From: Blaine Schmeisser notifications@github.com 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.

Nantris commented 7 years ago

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.

bayleedev commented 7 years ago

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.

afriedma commented 7 years ago

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