Refactor Accessibility for tree components
parent
f8725ae262
commit
4b17571644
|
@ -74,6 +74,10 @@ export interface CascadeSelectProps {
|
||||||
* Identifier of the underlying input element.
|
* Identifier of the underlying input element.
|
||||||
*/
|
*/
|
||||||
inputId?: string | undefined;
|
inputId?: string | undefined;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inputProps?: object | undefined;
|
||||||
/**
|
/**
|
||||||
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
|
||||||
* @see CascadeSelectAppendToType
|
* @see CascadeSelectAppendToType
|
||||||
|
@ -84,6 +88,10 @@ export interface CascadeSelectProps {
|
||||||
* Style class of the overlay panel.
|
* Style class of the overlay panel.
|
||||||
*/
|
*/
|
||||||
panelClass?: any;
|
panelClass?: any;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
panelProps?: object | undefined;
|
||||||
/**
|
/**
|
||||||
* Whether the dropdown is in loading state.
|
* Whether the dropdown is in loading state.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
</div>
|
</div>
|
||||||
<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" v-if="overlayVisible" @click="onOverlayClick" role="group">
|
<div :ref="overlayRef" :class="panelStyleClass" v-if="overlayVisible" @click="onOverlayClick" v-bind="panelProps">
|
||||||
<div class="p-cascadeselect-items-wrapper" role="group">
|
<div class="p-cascadeselect-items-wrapper" role="group">
|
||||||
<CascadeSelectSub :id="listId" role="tree" :options="options" :selectionPath="selectionPath"
|
<CascadeSelectSub :id="listId" :options="options" :selectionPath="selectionPath"
|
||||||
:optionLabel="optionLabel" :optionValue="optionValue" :level="0" :templates="$slots"
|
:optionLabel="optionLabel" :optionValue="optionValue" :level="0" :templates="$slots"
|
||||||
:optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren"
|
:optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren"
|
||||||
@option-select="onOptionSelect" @optiongroup-select="onOptionGroupSelect" :dirty="dirty" :root="true" />
|
@option-select="onOptionSelect" @optiongroup-select="onOptionGroupSelect" :dirty="dirty" :root="true" />
|
||||||
|
@ -63,6 +63,7 @@ export default {
|
||||||
default: 'body'
|
default: 'body'
|
||||||
},
|
},
|
||||||
panelClass: null,
|
panelClass: null,
|
||||||
|
panelProps: null,
|
||||||
loading: {
|
loading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<ul class="p-cascadeselect-panel p-cascadeselect-items" aria-orientation="horizontal">
|
<ul class="p-cascadeselect-panel p-cascadeselect-items" aria-orientation="horizontal" role="tree">
|
||||||
<template v-for="(option,index) of options" :key="getOptionLabelToRender(option)">
|
<template v-for="(option,index) of options" :key="getOptionLabelToRender(option)">
|
||||||
<li :class="getItemClass(option)" role="treeitem" :aria-label="getOptionLabelToRender(option)" :aria-selected="isOptionActive(option)" :aria-expanded="isOptionActive(option)"
|
<li :class="getItemClass(option)" role="treeitem" :aria-label="getOptionLabelToRender(option)" :aria-selected="isOptionActive(option)" :aria-expanded="isOptionActive(option)"
|
||||||
:aria-setsize="options.length" :aria-posinset="index + 1" :aria-level="level + 1">
|
:aria-setsize="options.length" :aria-posinset="index + 1" :aria-level="level + 1">
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
@keydown="onFilterKeydown" v-model="filterValue" />
|
@keydown="onFilterKeydown" v-model="filterValue" />
|
||||||
<span class="p-tree-filter-icon pi pi-search"></span>
|
<span class="p-tree-filter-icon pi pi-search"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-tree-wrapper" role="tree" :style="{maxHeight: scrollHeight}">
|
<div class="p-tree-wrapper" :style="{maxHeight: scrollHeight}">
|
||||||
<ul class="p-tree-container" role="group">
|
<ul class="p-tree-container" role="tree">
|
||||||
<TreeNode v-for="(node, index) of valueToRender" :key="node.key" :node="node" :templates="$slots" :level="level + 1" :index="index"
|
<TreeNode v-for="(node, index) of valueToRender" :key="node.key" :node="node" :templates="$slots" :level="level + 1" :index="index"
|
||||||
:expandedKeys="d_expandedKeys" @node-toggle="onNodeToggle" @node-click="onNodeClick"
|
:expandedKeys="d_expandedKeys" @node-toggle="onNodeToggle" @node-click="onNodeClick"
|
||||||
:selectionMode="selectionMode" :selectionKeys="selectionKeys" @checkbox-change="onCheckboxChange"></TreeNode>
|
:selectionMode="selectionMode" :selectionKeys="selectionKeys" @checkbox-change="onCheckboxChange"></TreeNode>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</div>
|
</div>
|
||||||
<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" v-if="overlayVisible" @click="onOverlayClick" :class="panelStyleClass">
|
<div :ref="overlayRef" v-if="overlayVisible" @click="onOverlayClick" :class="panelStyleClass" v-bind="panelProps">
|
||||||
<slot name="header" :value="modelValue" :options="options"></slot>
|
<slot name="header" :value="modelValue" :options="options"></slot>
|
||||||
<div class="p-treeselect-items-wrapper" :style="{'max-height': scrollHeight}">
|
<div class="p-treeselect-items-wrapper" :style="{'max-height': scrollHeight}">
|
||||||
<TSTree :id="listId" :value="options" :selectionMode="selectionMode" @update:selectionKeys="onSelectionChange" :selectionKeys="modelValue"
|
<TSTree :id="listId" :value="options" :selectionMode="selectionMode" @update:selectionKeys="onSelectionChange" :selectionKeys="modelValue"
|
||||||
|
@ -74,6 +74,7 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
panelProps: null,
|
||||||
appendTo: {
|
appendTo: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'body'
|
default: 'body'
|
||||||
|
|
Loading…
Reference in New Issue