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> <h1 class="sr-only">{label}</h1>
<div class="timeline" <div class="timeline"
role="feed" role="feed"
on:focusWithCapture="saveFocus(event)" on:focusin="saveFocus(event)"
on:blurWithCapture="clearFocus(event)" on:focusout="clearFocus()"
> >
{#await componentsPromise} {#await componentsPromise}
<!-- awaiting promise --> <!-- awaiting promise -->
@ -51,7 +51,6 @@
showMoreItemsForThread, showMoreItemsForThread,
showMoreItemsForCurrentTimeline showMoreItemsForCurrentTimeline
} from '../../_actions/timeline' } from '../../_actions/timeline'
import { focusWithCapture, blurWithCapture } from '../../_utils/events'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import isEqual from 'lodash-es/isEqual' import isEqual from 'lodash-es/isEqual'
@ -141,10 +140,6 @@
} }
}, },
store: () => store, store: () => store,
events: {
focusWithCapture,
blurWithCapture
},
methods: { methods: {
observe, observe,
initialize () { 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) { export function selectionChange (node, callback) {
let events = ['keyup', 'click', 'focus', 'blur'] let events = ['keyup', 'click', 'focus', 'blur']
let listener = () => { let listener = () => {