Skip to content

Commit

Permalink
chore: fix typos (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdufresne authored Jan 21, 2025
1 parent 465fc7e commit d42954b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/document/patchFocus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}
}

Expand All @@ -68,17 +68,17 @@ 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
}

const thisCall = Symbol('blur call')
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})
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/keyboard/parseKeyDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/focus/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit d42954b

Please sign in to comment.