Skip to content
New issue

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

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

Already on GitHub? # to your account

Add failing test for keyboard controls with x-teleport #4031

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

Ahrengot
Copy link
Contributor

Adds failing test for #4030

If the this.$refs.__items are replaced with this.$el in the following section then the test passes, so it seems to be related to teleported refs.

'@keydown'(e) { dom.search(Alpine, this.$refs.__items, e.key, el => el.__activate()) },
'@keydown.down.stop.prevent'() {
if (this.$data.__activeEl) dom.next(Alpine, this.$data.__activeEl, el => el.__activate())
else dom.first(Alpine, this.$refs.__items, el => el.__activate())
},
'@keydown.up.stop.prevent'() {
if (this.$data.__activeEl) dom.previous(Alpine, this.$data.__activeEl, el => el.__activate())
else dom.last(Alpine, this.$refs.__items, el => el.__activate())
},
'@keydown.home.stop.prevent'() { dom.first(Alpine, this.$refs.__items, el => el.__activate()) },
'@keydown.end.stop.prevent'() { dom.last(Alpine, this.$refs.__items, el => el.__activate()) },
'@keydown.page-up.stop.prevent'() { dom.first(Alpine, this.$refs.__items, el => el.__activate()) },
'@keydown.page-down.stop.prevent'() { dom.last(Alpine, this.$refs.__items, el => el.__activate()) },

@calebporzio calebporzio merged commit 1a86f08 into alpinejs:main Feb 13, 2024
1 check failed
@calebporzio
Copy link
Collaborator

Thanks for this @Ahrengot. It was a problem with $refs not working with teleports. It's been fixed.

In the future, when you submit a pull request, can you check out a new branch (not main) on your fork. That way I can push commits directly to this PR.

Thanks again!

@Ahrengot
Copy link
Contributor Author

Sure thing. I rarely make pull requests to public repos, and assumed you had control over the branch once it was submitted.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants