2022-12-08 12:26:57 +00:00
|
|
|
<template>
|
2022-12-19 11:57:07 +00:00
|
|
|
<div>
|
|
|
|
<Head>
|
2023-01-11 14:36:03 +00:00
|
|
|
<Title>Vue FocusTrap Directive</Title>
|
2022-12-19 11:57:07 +00:00
|
|
|
<Meta name="description" content="Focus Trap keeps focus within a certain DOM element while tabbing." />
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
<div class="content-section introduction">
|
|
|
|
<div class="feature-intro">
|
|
|
|
<h1>Focus Trap</h1>
|
|
|
|
<p>Focus Trap keeps focus within a certain DOM element while tabbing.</p>
|
|
|
|
</div>
|
|
|
|
<AppDemoActions />
|
2022-12-08 12:26:57 +00:00
|
|
|
</div>
|
|
|
|
|
2022-12-19 11:57:07 +00:00
|
|
|
<div class="content-section implementation focustrap-demo">
|
|
|
|
<div class="flex justify-content-center p-fluid">
|
|
|
|
<div v-focustrap class="card">
|
|
|
|
<div class="field">
|
|
|
|
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
|
2022-12-08 12:26:57 +00:00
|
|
|
</div>
|
2022-12-19 11:57:07 +00:00
|
|
|
<div class="field">
|
|
|
|
<div class="p-input-icon-right">
|
|
|
|
<i class="pi pi-envelope" />
|
|
|
|
<InputText id="email" v-model="email" type="email" placeholder="Email" />
|
|
|
|
</div>
|
2022-12-08 12:26:57 +00:00
|
|
|
</div>
|
2022-12-19 11:57:07 +00:00
|
|
|
<div class="field">
|
|
|
|
<div class="p-float-label">
|
|
|
|
<Password v-model="password">
|
|
|
|
<template #header>
|
|
|
|
<h6>Pick a password</h6>
|
|
|
|
</template>
|
|
|
|
<template #footer>
|
|
|
|
<Divider />
|
|
|
|
<p class="mt-2">Suggestions</p>
|
|
|
|
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5">
|
|
|
|
<li>At least one lowercase</li>
|
|
|
|
<li>At least one uppercase</li>
|
|
|
|
<li>At least one numeric</li>
|
|
|
|
<li>Minimum 8 characters</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
</Password>
|
|
|
|
<label for="password">Password</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field-checkbox">
|
|
|
|
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
|
|
|
|
<label for="accept">I agree to the terms and conditions*</label>
|
|
|
|
</div>
|
|
|
|
<Button type="submit" label="Submit" class="mt-2" />
|
2022-12-08 12:26:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-12-19 11:57:07 +00:00
|
|
|
<FocusTrapDoc />
|
|
|
|
</div>
|
2022-12-08 12:26:57 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import FocusTrapDoc from './FocusTrapDoc.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
name: null,
|
|
|
|
email: null,
|
|
|
|
password: null,
|
|
|
|
accept: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
FocusTrapDoc: FocusTrapDoc
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.focustrap-demo {
|
|
|
|
.card {
|
|
|
|
min-width: 450px;
|
|
|
|
|
|
|
|
.field {
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and (max-width: 960px) {
|
|
|
|
.card {
|
|
|
|
width: 80%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|