I believe that on macOS/Safari, it will send you notifications even when you're not on the page (or even have Safari open?) IOW, you're trying to get your work done in your favorite IDE and "hey, come check out the latest clickbait on ClickyBaity.com!"
I'm just pulling that straight out of my ass, as my response when confronted with that dialog is a hardy "oh, HELL, no!", but I kinda remember that being said at WWDC or summat. There might be a global on macOS to have it never, ever ask me again on any site, but I've just been too lazy/forgetful to go find it. (EDIT: the instructions found at this site seem to be spot on: http://appsliced.co/ask/how-do-i-disable-website-notificatio...)