Avoid forced style and layout recalculation when clicking entry in the sidebar

This commit is contained in:
Thibaut Courouble 2017-08-07 17:00:14 -04:00
parent f891e16f39
commit e7a0101910

View file

@ -16,11 +16,11 @@ class app.views.ListFocus extends app.View
super
@focusOnNextFrame = $.framify(@focus, @)
focus: (el) ->
focus: (el, options = {}) ->
if el and not el.classList.contains @constructor.activeClass
@blur()
el.classList.add @constructor.activeClass
$.trigger el, 'focus'
$.trigger el, 'focus' unless options.silent is true
return
blur: =>
@ -118,5 +118,5 @@ class app.views.ListFocus extends app.View
onClick: (event) =>
return if event.which isnt 1 or event.metaKey or event.ctrlKey
if event.target.tagName is 'A'
@focus event.target
@focus event.target, silent: true
return