UModal There are no focusable elements inside the <FocusTrap />
I recently start using nuxt and i'm trying to open a UModal. With my current code, the modal open sometimes. (when it doesn't, shows the message There are no focusable elements inside the <FocusTrap />). here's the gist with the file where i called the modal and the modal file itself: https://gist.github.com/JonatasBSM/f9fc4ae0b36eaca683690ebd951c052c
Gist
UModal There are no focusable elements inside the
UModal There are no focusable elements inside the - documentacao.vue



22 Replies
btw, the examples from nuxt documentation are returning the same result
Which examples?
this one, for example

That's expected for the example. There are no focusable elements in the modal.
Btw, I cannot reproduce, but I can with the TipoDocumento modal only because I'm removing all focusable elements. https://stackblitz.com/edit/github-virsxm?file=app.vue
are inputs focusable elements?
Yes. But all your modals have a button (the close modal button) so technically your modals do have a focusable element
i didnt get it. I shouldnt receive this error, right?
No, you shouldn't. But I can't reproduce with the code you've provided, so perhaps something else is happening?
can i share with you my github repository?
i dont know how to create an example
Sure
GitHub
GitHub - JonatasBSM/geFrontEnd
Contribute to JonatasBSM/geFrontEnd development by creating an account on GitHub.
i think you just need to do a npm install
the endpoint for this page is configuracoes/documentos
Can't reproduce the focus warning from the github repo you've provided either.
Might want to remove
<body>
here too https://github.com/JonatasBSM/geFrontEnd/blob/master/layouts/desktop/dashboard.vue#L23 - a document can only have one body.thanks for the body advise! The modals opened normally to you? Nothing about open one time, dont open next time?
maybe i need to update my packages?
btw, i just tested on firefox and worked normally. probably is my chrome version
Possibly. There's a lot of muddling of concepts, but I guess that's going to be part of your learning journey. For example, maybe avoid assigning a ref to the modal, and use v-model instead, etc.
i see
i'll take your tips with me in this journey
you're very kind
we'll probably talk again soon
thank you!
Any time!
Hey! About using v-model instead of ref, it would be a prop on child component?
Kind of. There’s a shorthand way of doing it by using
defineModel
But essentially it’s prop & emitParent:
Child:
like this? thatś really clean
Essentially yes, but don’t forget to use
defineModel
in the child, since that is the state being received from the parent. https://vuejs.org/guide/components/v-model.htmlVue.js
Vue.js - The Progressive JavaScript Framework
I used it! Just forgot to show you 🤣. That's really cool