Notifications progress

I’ve made some progress since my last post:

screenshot of early-stage new geolocation notification UI

Still rather ugly, but at least it’s functional!

Some things I’ll be looking into next:

  • the dismissal behavior – currently dismissing the notification (i.e. clicking elsewhere on the screen) denies the geolocation request. I think we want to instead keep the request pending and allow you to access it later from the site-identity menu, but that requires some extra work (tracking shown/unshown notifications, etc.)
  • make notifications triggered from background tabs/windows behave correctly (right now they’re just ignored)
  • multiple-notification stacking
  • support for different priorities (not sure this will be needed)
  • styling! – Stephen is working on mockups for menu-buttons, which is probably the most obvious issue

The current working API is very similar to the existing notificationbox API. It’s definitely not set in stone. Right now it looks like this:

var mainAction = {
  label: "Share Location",
  accessKey: "S",
  callback: function() {
    request.allow();
  },
};

var secondaryActions = [
  {
    label: "Always Share",
    accessKey: "A",
    callback: function () {
      Services.perms.add(requestingURI, "geo", ALLOW_ACTION);
      request.allow();
    }
  },
  {
    label: "Never Share",
    accessKey: "N",
    callback: function () {
      Services.perms.add(requestingURI, "geo", DENY_ACTION);
      request.cancel();
    }
  }
];

var dismissalAction = {
  callback: function() {
    request.cancel();
  }
};

Notification.show("geolocation", "title", message,
                  "chrome://browser/skin/Geo.png",
                  mainAction, secondaryActions,
                  dismissalAction, browser);

6 Comments »

  1. Josh said,

    April 17, 2010 @ 2:44 am

    The mockups look really amazing. This is going to look great when it’s landed!

  2. Jigar shah said,

    April 19, 2010 @ 1:25 am

    Looks great…Just a small note…these notification bubbles are mapping to OS specific themes or they are themeable ?

  3. gavin said,

    April 19, 2010 @ 12:19 pm

    They’ll be styled the same way the other similar panels (Larry, Add Bookmark) are.

  4. Theme Status (Timelines, Panels and Progress) « Chromatic Pixel said,

    April 20, 2010 @ 1:05 pm

    [...] notifications) on various platforms. Something I have been meaning to do but was prompted by Gavin’s work on notifications and the need for split button visual [...]

  5. BattleIT » Artiklid » Piilume kardinate taha – Mozilla Firefox 4 said,

    April 25, 2010 @ 8:08 am

    [...] küsida mida teha (kas salvestada, jagada asukohta jne). Sellekohta leiab pikemalt seletust Gavin‘i ajaveebis. Allpool leiad selle kuidas nad lõppversioonis välja hakkavad [...]

  6. Gavin’s blog » mise a jour said,

    June 25, 2010 @ 8:36 pm

    [...] the new “PopupNotifications” JS module, used to display popup-style notifications (as discussed earlier). Since then I’ve spent some time fixing followups, but there’s still a bunch [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment