diff --git a/src/document/patchFocus.ts b/src/document/patchFocus.ts index 153e2aff..f6e5d83b 100644 --- a/src/document/patchFocus.ts +++ b/src/document/patchFocus.ts @@ -39,27 +39,27 @@ export function patchFocus(HTMLElement: typeof globalThis['HTMLElement']) { return focus.call(this, options) } - const blured = getActiveTarget(this.ownerDocument) - if (blured === this) { + const blurred = getActiveTarget(this.ownerDocument) + if (blurred === this) { return } const thisCall = Symbol('focus call') activeCall = thisCall - if (blured) { - blur.call(blured) - dispatchDOMEvent(blured, 'blur', {relatedTarget: this}) - dispatchDOMEvent(blured, 'focusout', { + if (blurred) { + blur.call(blurred) + dispatchDOMEvent(blurred, 'blur', {relatedTarget: this}) + dispatchDOMEvent(blurred, 'focusout', { relatedTarget: activeCall === thisCall ? this : null, }) } if (activeCall === thisCall) { focus.call(this, options) - dispatchDOMEvent(this, 'focus', {relatedTarget: blured}) + dispatchDOMEvent(this, 'focus', {relatedTarget: blurred}) } if (activeCall === thisCall) { - dispatchDOMEvent(this, 'focusin', {relatedTarget: blured}) + dispatchDOMEvent(this, 'focusin', {relatedTarget: blurred}) } } @@ -68,8 +68,8 @@ export function patchFocus(HTMLElement: typeof globalThis['HTMLElement']) { return blur.call(this) } - const blured = getActiveTarget(this.ownerDocument) - if (blured !== this) { + const blurred = getActiveTarget(this.ownerDocument) + if (blurred !== this) { return } @@ -77,8 +77,8 @@ export function patchFocus(HTMLElement: typeof globalThis['HTMLElement']) { activeCall = thisCall blur.call(this) - dispatchDOMEvent(blured, 'blur', {relatedTarget: null}) - dispatchDOMEvent(blured, 'focusout', {relatedTarget: null}) + dispatchDOMEvent(blurred, 'blur', {relatedTarget: null}) + dispatchDOMEvent(blurred, 'focusout', {relatedTarget: null}) } } diff --git a/src/keyboard/parseKeyDef.ts b/src/keyboard/parseKeyDef.ts index 5c149685..5cb87aba 100644 --- a/src/keyboard/parseKeyDef.ts +++ b/src/keyboard/parseKeyDef.ts @@ -2,7 +2,7 @@ import {keyboardKey} from '../system/keyboard' import {readNextDescriptor} from '../utils' /** - * Parse key defintions per `keyboardMap` + * Parse key definitions per `keyboardMap` * * Keys can be referenced by `{key}` or `{special}` as well as physical locations per `[code]`. * Everything else will be interpreted as a typed character - e.g. `a`. diff --git a/src/utils/focus/cursor.ts b/src/utils/focus/cursor.ts index 705de6d3..e5d54204 100644 --- a/src/utils/focus/cursor.ts +++ b/src/utils/focus/cursor.ts @@ -23,7 +23,7 @@ export function getNextCursorPosition( // Firefox always moves to zero offset and jumps over last offset. // Chrome jumps over zero offset per default but over last offset when Shift is pressed. // The cursor always moves to zero offset if the focus area (contenteditable or body) ends there. - // When walking foward both ignore zero offset. + // When walking forward both ignore zero offset. // When walking over input elements the cursor moves before or after that element. // When walking over line breaks the cursor moves inside any following text node.