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

pull/647/merge
Thibaut Courouble 8 years ago
parent f891e16f39
commit e7a0101910

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

Loading…
Cancel
Save