1995eaton / chromium-vim

Vim bindings for Google Chrome.
https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojhcghmfjfneahoeklbjjh
MIT License
2.25k stars 325 forks source link

Hover doesn't work with foundation's top bar. #351

Open lethjakman opened 9 years ago

lethjakman commented 9 years ago

I've noticed that the hover (q) capability doesn't work in a lot of places, specifically with foundation's top bar.

http://foundation.zurb.com/docs/components/topbar.html

slid1amo2n3e4 commented 9 years ago

Yes, it seems like DOM.mouseEvent doesn't do anything (though I haven't looked more closely at the code). Anyway, an easy, quick fix is to replace https://github.com/1995eaton/chromium-vim/blob/master/content_scripts/hints.js#L149 with this:

    case 'hover':
      if (Hints.lastHover) {
        link.blur();
        DOM.mouseEvent('unhover', Hints.lastHover);
        if (Hints.lastHover === link) {
          Hints.lastHover = null;
          break;
        }
      }
      link.focus();
      DOM.mouseEvent('hover', link);
      Hints.lastHover = link;
      break;

and https://github.com/1995eaton/chromium-vim/blob/master/content_scripts/hints.js#L167 with this:

    case 'unhover':
      DOM.mouseEvent('unhover', link);
      Hints.lastHover = null;
      link.blur();
      break;
1995eaton commented 9 years ago

I think the issue here has to do with CSS hover selectors. My implementation only triggers hovering by faking JavaScript mouseover (and related) events. I'm not sure if there's a way to do this.