mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Avoid forced style and layout recalculation when clicking entry in the sidebar
This commit is contained in:
parent
f891e16f39
commit
e7a0101910
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue