Skip to content
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

Use x-Focus Alpine JS plugin for Livewire stack modal #1186

Merged
merged 4 commits into from
Dec 2, 2022

Conversation

x7ryan
Copy link
Contributor

@x7ryan x7ryan commented Dec 1, 2022

This PR replaces the custom focus trapping logic within the Livewire stack's modal with Alpine JS's x-Focus plugin.

The down-side is this does introduce a new dependency. However at the same time it reduces overall code needed to be maintained directly, is cleaner, widely used, all while improving accessibility.

This improves accessibility bu utilizing the .inert modifier when defining the focus trapping (see: https://alpinejs.dev/plugins/focus#inert), which will add an aria-hidden="true" property to all elements outside the modal while it is open.

I believe this is a net improvement and worth bringing in the dependency. However if you disagree Taylor, no hard feelings if you close this.

@x7ryan x7ryan changed the title Use x focus alpine plugin Use x-Focus Alpine JS plugin for Livewire stack modal Dec 1, 2022
@driesvints
Copy link
Member

@x7ryan great pr!

@taylorotwell taylorotwell merged commit 8276d10 into laravel:2.x Dec 2, 2022
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.

None yet

3 participants