Client - make "show password" keyboard-navigable

This commit is contained in:
Sam 2023-07-12 20:16:53 +02:00
parent a831f5732b
commit 5c26f41e0b
2 changed files with 20 additions and 13 deletions

View File

@ -11,13 +11,15 @@
@input="updatePassword" @input="updatePassword"
@invalid="invalidPassword" @invalid="invalidPassword"
/> />
<div class="show-password" @click="togglePassword"> <div class="show-password">
<button class="transparent" @click.prevent="togglePassword" type="button">
{{ $t(`user.${showPassword ? 'HIDE' : 'SHOW'}_PASSWORD`) }} {{ $t(`user.${showPassword ? 'HIDE' : 'SHOW'}_PASSWORD`) }}
<i <i
class="fa" class="fa"
:class="`fa-eye${showPassword ? '-slash' : ''}`" :class="`fa-eye${showPassword ? '-slash' : ''}`"
aria-hidden="true" aria-hidden="true"
/> />
</button>
</div> </div>
<div v-if="checkStrength" class="form-info"> <div v-if="checkStrength" class="form-info">
<i class="fa fa-info-circle" aria-hidden="true" /> <i class="fa fa-info-circle" aria-hidden="true" />
@ -71,6 +73,7 @@
(newPassword) => { (newPassword) => {
if (newPassword === '') { if (newPassword === '') {
passwordValue.value = '' passwordValue.value = ''
showPassword.value = false
} }
} }
) )
@ -84,12 +87,15 @@
flex-direction: column; flex-direction: column;
.show-password { .show-password {
margin-top: -0.5 * $default-margin;
display: flex;
justify-content: right;
button {
font-style: italic; font-style: italic;
font-size: 0.85em; font-size: 0.85em;
text-align: right; padding: $default-padding * 0.5 $default-padding;
margin-top: -0.75 * $default-margin;
padding-right: $default-padding;
cursor: pointer; cursor: pointer;
} }
} }
}
</style> </style>

View File

@ -9,6 +9,7 @@
min="0" min="0"
max="4" max="4"
step="1" step="1"
:tabindex="-1"
/> />
<div v-if="passwordStrength" class="password-strength-details"> <div v-if="passwordStrength" class="password-strength-details">
<span class="password-strength-value"> <span class="password-strength-value">