Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/components/modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ import { FwbModal } from 'flowbite-vue'

## Focus Trap

You can enable focus trapping by setting the `focus-trap` prop to `true`. This keeps the focus within the modal, preventing users from tabbing to elements outside of it, which improves accessibility.
You can enable focus trapping by setting the `focus-trap` prop to `true`. This keeps the focus within the modal, preventing users from tabbing to elements outside of it, which improves accessibility. esc key will still close the modal.

<fwb-modal-example-focus-trap />
```vue
Expand Down
1 change: 1 addition & 0 deletions src/components/FwbModal/FwbModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const modalRef: Ref<HTMLElement | null> = ref(null)
const { activate, deactivate } = useFocusTrap(modalRef, {
immediate: false,
initialFocus: () => modalRef.value?.querySelector('button[aria-label="close"]') || modalRef.value,
escapeDeactivates: false,
})

onMounted(async () => {
Expand Down
Loading