Update tabbable and focus-trap dependencies in focus plugin#4737
Update tabbable and focus-trap dependencies in focus plugin#4737calebporzio merged 4 commits intomainfrom
tabbable and focus-trap dependencies in focus plugin#4737Conversation
Update `tabbable` from ^5.3.3 to ^6.4.0 and `focus-trap` from ^6.9.4 to ^8.0.0. These packages only support their most recently published version, so staying on older versions means no security patches. This addresses concerns raised in governmental security audits. Breaking changes in these packages (IE support dropped, displayCheck defaults) do not affect Alpine's usage patterns.
These tests cover scenarios related to the tabbable/focus-trap upgrade: - x-trap works with radio button groups - $focus.focusables excludes elements with inert attribute (new feature) - x-trap handles dynamically added focusable elements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR Review: #4737 — Update
|
This PR updates the
tabbableandfocus-trapdependencies in the@alpinejs/focusplugin.tabbablefocus-trapContext
A user reported that a governmental security audit flagged these dependencies as outdated. The maintainers of
tabbableandfocus-traponly support the latest version. Older releases don't receive security fixes, so staying current ensures we receive any future security patches.Related: #4727
Breaking Changes in Upstream Packages
tabbable 5.x → 6.x
displayCheck: 'full'no longer treats detached nodes as visible: ❌ Not relevant. Alpine usesdisplayCheck: 'none'forfocusable()calls.isTabbableRadio()returns fewer elements in nested scenarios:focus-trap 6.x → 7.x
displayCheckbehaviour:displayCheck, not overridden by Alpine.focus-trap 7.x → 8.x
onPostActivate()now called after initial focus is set (previously called before): ✅ Tested. Alpine's.inertmodifier usesonPostActivatebut wraps it inAlpine.nextTick(), which already deferred execution. All tests pass.New Features Available
inertattribute support: elements with HTMLinertattribute are properly excluded from tabbable resultsisolateSubtreesoption in focus-trap (similar to what Alpine does manually witharia-hidden)Testing
All 23 tests pass, including 3 new tests added to cover upgrade-related scenarios:
x-trap works with radio button groups: verifies focus trap works correctly with radio groups$focus.focusables excludes elements with inert attribute: tests newinertattribute support from tabbable v6x-trap handles dynamically added focusable elements: verifies trap adapts when elements are added