Skip to content

Added new modifier to Focus plugin #4578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tuimz
Copy link

@tuimz tuimz commented Mar 17, 2025

Underlaying focus-trap library supports disabling the scroll to currently focussed element.

This specific usecase is required in my case for Filament which uses Livewire/Alpine under the hood for its modals.

If you have a very lenghty modal with a vertical scrollbar for its content, and you have a focussed element outside your viewport and you click anywhere in the modal (thus blurring the element triggering some Livewire changes) the x-trap gets re-initialized and automatically scrolls you to the focussed element.

This PR adds a new modifier (incl its docs) which effectively sets preventScroll in the options of the underlaying focus-trap instance.

See also: https://github.com/focus-trap/focus-trap#:~:text=and%20selector%20strings.-,preventScroll,-%7Bboolean%7D%3A%20By

Tim Aerdts added 3 commits March 17, 2025 15:30
Underlaying focus-trap library supports disabling the scroll to currently focussed element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant