]> git.gir.st - VimFx.git/commit
Give better hints to semantic elements than unsemantic ones
authorSimon Lydell <simon.lydell@gmail.com>
Fri, 23 Jan 2015 20:01:57 +0000 (21:01 +0100)
committerSimon Lydell <simon.lydell@gmail.com>
Fri, 23 Jan 2015 20:01:57 +0000 (21:01 +0100)
commit0165742129edd4cb57dfd6574be314cc7a758c3a
treea89ec232910466c6da66ab9d697a8fbbd8fa52dc
parent6ba3eb88e883d330e90adfd4b1e2e5cef7deebcf
Give better hints to semantic elements than unsemantic ones

On reddit, each post wrapper has an `onclick` attribute, which makes it
markable. Of course the wrapper has larger area than anything inside of it. This
causes it to get a larger weight than the post title link. The title link is
what the user reads and wants to click, not the entire wrapper. Therefore it
should get a better hint.

There are other similar examples as well. Unsemantic elements (such as those
with `on*` properties, or those whose class contains "button") need to be able
to be clicked, but semantic ones (such as anchors, buttons and form elements)
should be favored.

This commit also fixes #320: Sometimes button elements are wrapped in a div with
a class such as "button-wrapper". Because that contains "button" the wrapper
element gets a marker as well, even though it cannot be clicked. Since it wraps
the actual button it naturally gets a larger weight and therefore a higher
z-index, which makes it overlap the marker for the clickable button. Now,
semantic elements get their z-indexes assigned _after_ the unsemantic ones
instead, which makes them go on top.
extension/lib/mode-hints/hints.coffee
extension/lib/utils.coffee
Imprint / Impressum