Skip to content

Commit 4ddee78

Browse files
committed
fix result toolbar button focus handling
1 parent 6f9fa72 commit 4ddee78

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/editor/result-view.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,19 @@ export default class ResultView {
155155
for (let b of buttons(this.model)) {
156156
let v = document.createElement('button')
157157
v.classList.add('btn', b.icon)
158-
v.addEventListener('click', b.onclick)
158+
v.addEventListener('mouseup', ev => {
159+
b.onclick()
160+
this.focusPrevious()
161+
})
162+
163+
v.addEventListener('mousedown', ev => {
164+
this.blurEditor()
165+
this.previousFocus = document.activeElement
166+
})
167+
168+
v.addEventListener('mouseleave', ev => {
169+
this.focusPrevious()
170+
})
159171
tb.appendChild(v)
160172
}
161173
}

0 commit comments

Comments
 (0)