fix: use focusin/focusout instead of custom events (#1308)

This commit is contained in:
Nolan Lawson 2019-07-07 11:43:35 -07:00 committed by GitHub
parent 38241abf35
commit 19566bda2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 25 deletions

View File

@ -1,8 +1,8 @@
<h1 class="sr-only">{label}</h1>
<div class="timeline"
role="feed"
on:focusWithCapture="saveFocus(event)"
on:blurWithCapture="clearFocus(event)"
on:focusin="saveFocus(event)"
on:focusout="clearFocus()"
>
{#await componentsPromise}
<!-- awaiting promise -->
@ -51,7 +51,6 @@
showMoreItemsForThread,
showMoreItemsForCurrentTimeline
} from '../../_actions/timeline'
import { focusWithCapture, blurWithCapture } from '../../_utils/events'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import { mark, stop } from '../../_utils/marks'
import isEqual from 'lodash-es/isEqual'
@ -141,10 +140,6 @@
}
},
store: () => store,
events: {
focusWithCapture,
blurWithCapture
},
methods: {
observe,
initialize () {

View File

@ -17,24 +17,6 @@ export function mouseover (node, callback) {
}
}
export function focusWithCapture (node, callback) {
node.addEventListener('focus', callback, true)
return {
destroy () {
node.removeEventListener('focus', callback, true)
}
}
}
export function blurWithCapture (node, callback) {
node.addEventListener('blur', callback, true)
return {
destroy () {
node.removeEventListener('blur', callback, true)
}
}
}
export function selectionChange (node, callback) {
let events = ['keyup', 'click', 'focus', 'blur']
let listener = () => {