Skip to content

Commit

Permalink
Remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJDev committed Aug 21, 2024
1 parent 810400d commit 9c89a27
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/focus-trap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ function followSignal(signal: AbortSignal): AbortController {
}

function observeFocusTrap(container: HTMLElement, sentinels: HTMLElement[]) {
console.log('Observe Focus Trap Init')
const observer = new MutationObserver(mutations => {
console.log('New mutation')
for (const mutation of mutations) {
console.log('Mutations:', mutations)
if (mutation.type === 'childList' && mutation.addedNodes.length) {
const sentinelChildren = Array.from(
mutation.addedNodes,
Expand All @@ -46,7 +43,6 @@ function observeFocusTrap(container: HTMLElement, sentinels: HTMLElement[]) {
if (sentinelChildren.length) {
return
}
console.log('ChildList Mutation')
// If the first and last children of container aren't sentinels, move them to the start and end
const firstChild = container.firstElementChild
const lastChild = container.lastElementChild
Expand All @@ -56,11 +52,9 @@ function observeFocusTrap(container: HTMLElement, sentinels: HTMLElement[]) {
// Adds back sentinel to correct position in the DOM
if (!firstChild?.classList.contains('sentinel')) {
container.insertAdjacentElement('afterbegin', sentinelStart)
console.log('Adjust sentinel to start')
}
if (!lastChild?.classList.contains('sentinel')) {
container.insertAdjacentElement('beforeend', sentinelEnd)
console.log('Adjust sentinel to end')
}
}
}
Expand Down

0 comments on commit 9c89a27

Please sign in to comment.