-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Description
- Regression from: Add config option to isolate trap subtrees #1691
focus-trap supports having a global trap stack via trapStack option.
Although it is not promised in the documentation, it supported not only multiple focus-trap instances, but also multiple focus-trap packages. This is valuable for application platforms where multiple independent applications/libraries are running on the same page without module federations.
// Anywhere
window.TRAP_STACK ??= []
// UI library
import { createFocusTrap } from 'focus-trap' // v7.7.0
createFocusTrap(el, {
trapStack: window.TRAP_STACK,
})
// App 1
import { createFocusTrap } from 'focus-trap' // v7.7.0
createFocusTrap(el, {
trapStack: window.TRAP_STACK,
})
// App 2
import { createFocusTrap } from 'focus-trap' // v7.6.8
createFocusTrap(el, {
trapStack: window.TRAP_STACK,
})While it worked for a long time, starting v7.7 it results in preexistingTrap._setSubtreeIsolation is not a function.
Proposal: handle a case when a focus trap instance from the trap stack has no subtree isolation implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels