News for hackers. Stuff that matters.
Re:Focusable – Set a spotlight focus on DOM element by tsergiu on Sunday December 14, 2014 @10:58AM (#8748578)
This overlay technique works beautifully for guided, interactive tutorials.

We've had great success using it in our tutorials to get users quickly up to speed with our product.

It works better than the similar "show bubble beside dom element" technique[1] for a few reasons:

1) With bubbles, you need real estate next to the element to display the help text. This often doesn't exist, especially e.g. inside a frame in a Firefox sidebar. By fading everything else out, it is easy to have the help text in a different location.

2) Bubbles are typically not as high contrast as the overlay, so they are a weaker mechanism for drawing attention.

3) With the overlay technique, you can highlight multiple elements at once, which is impossible with bubbles. This is critical when you need to explain how two things relate to each other, and something that seems to be missing in this library.

You can check out how we did our interactive tutorials at http://www.parsehub.com (they're within the extension).

[1] http://css-tricks.com/bubble-point-tooltips-with-css3-jquery...

Re:Focusable – Set a spotlight focus on DOM element by peterjmag on Sunday December 14, 2014 @11:49AM (#8748718)
I've used Intro.js[1] in the past for this technique, and I've been pretty happy with it.

[1] http://usablica.github.io/intro.js/

Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @12:52PM (#8748930)
Yes, intro.js is a great lib, I know that, but for me has an important missing feature; you can't interact with the focused element, I mean, you don't have any mouse event or similar... this is the only bad thing I think.
Re:Focusable – Set a spotlight focus on DOM element by afshinmeh on Sunday December 14, 2014 @02:11PM (#8749199)
Thanks for this feedback dude, I will concentrate to address remaining issues, including what you mentioned.

Cheers :)

Re:Focusable – Set a spotlight focus on DOM element by afshinmeh on Sunday December 14, 2014 @02:10PM (#8749196)
Thanks!
Re:Focusable – Set a spotlight focus on DOM element by colinramsay on Sunday December 14, 2014 @06:58AM (#8748086)
Looks great, and glad to see that removing the jQuery dependency is on your todo list!
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @07:11AM (#8748111)
Thanks sir! At the beginning I tried to implement the lib only with the Dom api, but was a little painful because isn't very agile and tedious... so I ended with the jQuery dependency, thing that I want to remove in the future.
Re:Focusable – Set a spotlight focus on DOM element by danmaz74 on Sunday December 14, 2014 @07:28AM (#8748143)
Maybe an intermediate (or even final) solution could be to make it work using only zepto?
Re:Focusable – Set a spotlight focus on DOM element by notduncansmith on Sunday December 14, 2014 @10:12AM (#8748446)
(shameless plug) Here's a similar library with no dependencies :)

https://github.com/notduncansmith/showcase

Re:Focusable – Set a spotlight focus on DOM element by spdustin on Sunday December 14, 2014 @12:44PM (#8748899)
Since it's tangentially related, is anyone aware of a tool (browser based or Mac-supported) that would take a CSS selector and, rather than spotlight it, capture a screenshot of its bounding box? Ideally, capturing multiple screenshots if there are multiple matching elements?
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @12:54PM (#8748939)
I think that you're looking for is that http://html2canvas.hertzen.com/ :D
Re:Focusable – Set a spotlight focus on DOM element by petercooper on Sunday December 14, 2014 @07:10AM (#8748109)
I'd need to look into the code as I couldn't find a live demo to quickly noodle with, but my first thought was to add a border radius or some sort of blur filter to make it more spotlight-like? :)
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @07:51AM (#8748179)
You can find a live demo here (https://github.com/zzarcon/focusable/tree/master/sample-app).

About adding a border-radius, I'll love that feature, in fact I was thinking about implement it, but isn't as easy as it seems.

TLDR: Right now they are 4 divs for making the focus enable:

1- Fills the left part of the page. 2- Fills the top part of the page to the top part of the element. 3- Fills the bottom part of the element to the bottom part of the page. 4- Fills the right part of the page.

These divs are absolute positioned inside a wrapper that have disabled the pointer events to enable the interaction with the focused element.

So for that reason I can't simply add a border-radius for the active element.

This images can help me to explain you how it works http://cl.ly/image/3g2K2N1j1S3S http://cl.ly/image/031j3p283235

Re:Focusable – Set a spotlight focus on DOM element by Domenic_S on Sunday December 14, 2014 @11:38AM (#8748675)
That isn't a live demo.

Once again we find on HN a UI project with no link to a live demo on the project page.

Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @01:06PM (#8748978)
Sorry man, you're right, I updated the Readme and put there a live demo link. Hope you like http://www.mrdrozdov.com/focusable/sample-app/index.html
Re:Focusable – Set a spotlight focus on DOM element by Domenic_S on Wednesday December 17, 2014 @12:59PM (#8763354)
Awesome, thanks. After you focus a non-header area, how do you get back to a normal state? Clicking around doesn't remove the black area, ESC doesn't either. Mac/Chrome.
Re:Focusable – Set a spotlight focus on DOM element by WiseWeasel on Sunday December 14, 2014 @07:30PM (#8750126)
Here's kind of a way to do it:

  #overlay-layer .column:nth-child(2):after,
  #overlay-layer .column:nth-child(2):before,
  #overlay-layer .column:nth-child(3):after,
  #overlay-layer .column:nth-child(3):before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 5px;
  }

  #overlay-layer .column:nth-child(2):after {
    right: 0;
    bottom: -10px;
    box-shadow: 5px -5px 1px rgba(0,0,0,0.8);
  }

  #overlay-layer .column:nth-child(2):before {
    left: 0;
    bottom: -10px;
    box-shadow: -5px -5px 1px rgba(0,0,0,0.8);
  }

  #overlay-layer .column:nth-child(3):after {
    right: 0;
    top: -10px;
    box-shadow: 5px 5px 1px rgba(0,0,0,0.8);
  }

  #overlay-layer .column:nth-child(3):before {
    left: 0;
    top: -10px;
    box-shadow: -5px 5px 1px rgba(0,0,0,0.8);
  }
Re:Focusable – Set a spotlight focus on DOM element by Rygu on Sunday December 14, 2014 @08:22AM (#8748232)
Create a 5th div that exactly overlays the focussed element, and give the overlay an inset box-shadow. (You may need to pass through mouse events programmatically.)
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @08:33AM (#8748259)
That's sounds good and easy, and can accomplish the goal, I'll open a PR for try your approach, thanks!
Re:Focusable – Set a spotlight focus on DOM element by RubyPinch on Sunday December 14, 2014 @08:39AM (#8748265)
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @08:42AM (#8748273)
Yeah! is the approach I also follow in the library, you can check it here https://github.com/zzarcon/focusable/blob/master/app/focus-e...
Re:Focusable – Set a spotlight focus on DOM element by mrdrozdov on Sunday December 14, 2014 @12:08PM (#8748782)
I forked the repo, and used github pages to host the sample-app code. You can view a live demo here: http://www.mrdrozdov.com/focusable/sample-app/index.html
Re:Focusable – Set a spotlight focus on DOM element by zzarcon on Sunday December 14, 2014 @12:44PM (#8748900)
So cool man, I just added your link to the Readme, thanks for the support!
Re:Focusable – Set a spotlight focus on DOM element by jayflux on Sunday December 14, 2014 @04:07PM (#8749561)
I've attempted to remove the jQuery dependancy https://github.com/zzarcon/focusable/pull/11
Re:Focusable – Set a spotlight focus on DOM element by cardamomo on Sunday December 14, 2014 @10:19AM (#8748465)
This reminds me a lot of Fokus (http://lab.hakim.se/fokus/).
Re:Focusable – Set a spotlight focus on DOM element by tanveerhn on Sunday December 14, 2014 @05:09PM (#8749738)
This would be great for user on-boarding of our product. Perfect timing... will let you know how it goes.
Re:Focusable – Set a spotlight focus on DOM element by dhpe on Sunday December 14, 2014 @08:32AM (#8748255)
Thanks, this is useful.