Unified · Split
| @@ -30,6 +30,7 @@ class app.views.DocPicker extends app.View · 29 unmodified lines | |||
| 30 | @empty() | 30 | @empty() |
| 31 | app.appCache?.off 'progress', @onAppCacheProgress | 31 | app.appCache?.off 'progress', @onAppCacheProgress |
| 32 | $.off @el, 'focus', @onDOMFocus, true | 32 | $.off @el, 'focus', @onDOMFocus, true |
| 33 | @focusEl = null | ||
| 33 | return | 34 | return |
| 34 | 35 | ||
| 35 | render: -> | 36 | render: -> |
| @@ -101,8 +102,16 @@ class app.views.DocPicker extends app.View · 65 unmodified lines | |||
| 101 | else if target.classList.contains(app.views.ListFold.targetClass) | 102 | else if target.classList.contains(app.views.ListFold.targetClass) |
| 102 | target.blur() | 103 | target.blur() |
| 103 | unless @mouseDown and @mouseDown > Date.now() - 100 | 104 | unless @mouseDown and @mouseDown > Date.now() - 100 |
| 104 | @listFold.open(target) unless target.classList.contains(app.views.ListFold.activeClass) | 105 | if @focusEl is $('input', target.nextElementSibling) |
| 105 | $('input', target.nextElementSibling).focus() | 106 | @listFold.close(target) if target.classList.contains(app.views.ListFold.activeClass) |
| 107 | prev = target.previousElementSibling | ||
| 108 | prev = prev.previousElementSibling until prev.tagName is 'LABEL' or prev.classList.contains(app.views.ListFold.targetClass) | ||
| 109 | prev = $.makeArray($$('input', prev.nextElementSibling)).pop() if prev.classList.contains(app.views.ListFold.activeClass) | ||
| 110 | @delay -> prev.focus() | ||
| 111 | else | ||
| 112 | @listFold.open(target) unless target.classList.contains(app.views.ListFold.activeClass) | ||
| 113 | @delay -> $('input', target.nextElementSibling).focus() | ||
| 114 | @focusEl = target | ||
| 106 | return | 115 | return |
| 107 | 116 | ||
| 108 | onEnter: => | 117 | onEnter: => |