Accessibility Password: aria-* properties added
parent
9ba22cf24c
commit
20edb1c247
|
@ -77,6 +77,12 @@ const PasswordProps = [
|
||||||
default: "pi pi-eye",
|
default: "pi pi-eye",
|
||||||
description: "Icon to show displaying the password as plain text."
|
description: "Icon to show displaying the password as plain text."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "inputId",
|
||||||
|
type: "string",
|
||||||
|
default: "null",
|
||||||
|
description: "Identifier of the underlying input element."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "inputStyle",
|
name: "inputStyle",
|
||||||
type: "any",
|
type: "any",
|
||||||
|
@ -89,11 +95,23 @@ const PasswordProps = [
|
||||||
default: "null",
|
default: "null",
|
||||||
description: "Style class of the input field."
|
description: "Style class of the input field."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "panelId",
|
||||||
|
type: "string",
|
||||||
|
default: "null",
|
||||||
|
description: "Identifier of the underlying overlay panel element."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "panelClass",
|
name: "panelClass",
|
||||||
type: "string",
|
type: "string",
|
||||||
default: "null",
|
default: "null",
|
||||||
description: "Style class of the overlay panel."
|
description: "Style class of the overlay panel."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "panelStyle",
|
||||||
|
type: "string",
|
||||||
|
default: "null",
|
||||||
|
description: "Inline style of the overlay panel."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,6 @@ export interface PasswordProps extends InputHTMLAttributes {
|
||||||
* Value of the component.
|
* Value of the component.
|
||||||
*/
|
*/
|
||||||
modelValue?: Nullable<string>;
|
modelValue?: Nullable<string>;
|
||||||
/**
|
|
||||||
* Identifier of the underlying input element.
|
|
||||||
*/
|
|
||||||
inputId?: string | undefined;
|
|
||||||
/**
|
/**
|
||||||
* Text to prompt password entry. Defaults to PrimeVue Locale configuration.
|
* Text to prompt password entry. Defaults to PrimeVue Locale configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +59,10 @@ export interface PasswordProps extends InputHTMLAttributes {
|
||||||
* Default value is 'pi pi-eye'.
|
* Default value is 'pi pi-eye'.
|
||||||
*/
|
*/
|
||||||
showIcon?: string | undefined;
|
showIcon?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Identifier of the underlying input element.
|
||||||
|
*/
|
||||||
|
inputId?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Inline style of the input field.
|
* Inline style of the input field.
|
||||||
*/
|
*/
|
||||||
|
@ -71,10 +71,22 @@ export interface PasswordProps extends InputHTMLAttributes {
|
||||||
* Style class of the input field.
|
* Style class of the input field.
|
||||||
*/
|
*/
|
||||||
inputClass?: any | undefined;
|
inputClass?: any | undefined;
|
||||||
|
/**
|
||||||
|
* Identifier of the underlying overlay panel element.
|
||||||
|
*/
|
||||||
|
panelId?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Style class of the overlay panel.
|
* Style class of the overlay panel.
|
||||||
*/
|
*/
|
||||||
panelClass?: any | undefined;
|
panelClass?: any | undefined;
|
||||||
|
/**
|
||||||
|
* Inline style of the overlay panel.
|
||||||
|
*/
|
||||||
|
panelStyle?: any | undefined;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
panelProps?: object | undefined;
|
||||||
/**
|
/**
|
||||||
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="containerClass">
|
<div :class="containerClass">
|
||||||
<PInputText ref="input" :id="inputId" :type="inputType" :class="inputClass" :style="inputStyle" :value="modelValue" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" @input="onInput" @focus="onFocus" @blur="onBlur" @keyup="onKeyUp" v-bind="inputProps" />
|
<PInputText ref="input" :id="inputId" :type="inputType" :class="inputClass" :style="inputStyle" :value="modelValue" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel"
|
||||||
|
:aria-controls="(panelProps&&panelProps.id)||panelId||panelUniqueId" :aria-expanded="overlayVisible" :aria-haspopup="true"
|
||||||
|
@input="onInput" @focus="onFocus" @blur="onBlur" @keyup="onKeyUp" v-bind="inputProps" />
|
||||||
<i v-if="toggleMask" :class="toggleIconClass" @click="onMaskToggle" />
|
<i v-if="toggleMask" :class="toggleIconClass" @click="onMaskToggle" />
|
||||||
<span class="p-hidden-accessible" aria-live="polite">
|
<span class="p-hidden-accessible" aria-live="polite">
|
||||||
{{infoText}}
|
{{infoText}}
|
||||||
</span>
|
</span>
|
||||||
<Portal :appendTo="appendTo">
|
<Portal :appendTo="appendTo">
|
||||||
<transition name="p-connected-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
|
<transition name="p-connected-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
|
||||||
<div :ref="overlayRef" :class="panelStyleClass" :style="panelStyle" v-if="overlayVisible" @click="onOverlayClick" v-bind="panelProps">
|
<div :ref="overlayRef" :id="panelId||panelUniqueId" :class="panelStyleClass" :style="panelStyle" v-if="overlayVisible" @click="onOverlayClick" v-bind="panelProps">
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
<slot name="content">
|
<slot name="content">
|
||||||
<div class="p-password-meter">
|
<div class="p-password-meter">
|
||||||
|
@ -23,7 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {ConnectedOverlayScrollHandler,DomHandler,ZIndexUtils} from 'primevue/utils';
|
import {ConnectedOverlayScrollHandler,DomHandler,ZIndexUtils,UniqueComponentId} from 'primevue/utils';
|
||||||
import OverlayEventBus from 'primevue/overlayeventbus';
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
||||||
import InputText from 'primevue/inputtext';
|
import InputText from 'primevue/inputtext';
|
||||||
import Portal from 'primevue/portal';
|
import Portal from 'primevue/portal';
|
||||||
|
@ -86,8 +88,9 @@ export default {
|
||||||
inputClass: null,
|
inputClass: null,
|
||||||
inputStyle: null,
|
inputStyle: null,
|
||||||
inputProps: null,
|
inputProps: null,
|
||||||
panelClass: String,
|
panelId: null,
|
||||||
panelStyle: String,
|
panelClass: null,
|
||||||
|
panelStyle: null,
|
||||||
panelProps: null,
|
panelProps: null,
|
||||||
'aria-labelledby': {
|
'aria-labelledby': {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -322,6 +325,9 @@ export default {
|
||||||
},
|
},
|
||||||
promptText() {
|
promptText() {
|
||||||
return this.promptLabel || this.$primevue.config.locale.passwordPrompt;
|
return this.promptLabel || this.$primevue.config.locale.passwordPrompt;
|
||||||
|
},
|
||||||
|
panelUniqueId() {
|
||||||
|
return UniqueComponentId() + '_panel';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -173,6 +173,12 @@ import Password from 'primevue/password';
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Inline style of the input field.</td>
|
<td>Inline style of the input field.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>panelId</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Identifier of the underlying overlay panel element.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>panelClass</td>
|
<td>panelClass</td>
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
|
|
Loading…
Reference in New Issue