Fixed #1632 - Improve accessibility on Editable DataTable

pull/1643/head
mertsincan 2021-10-04 11:27:08 +03:00
parent 1c142f83a6
commit 81ef7ee157
3 changed files with 11 additions and 0 deletions

View File

@ -113,6 +113,11 @@ export default {
if (this.columnProp('frozen')) {
this.updateStickyPosition();
}
if (this.d_editing && (this.editMode === 'cell' || (this.editMode === 'row' && this.columnProp('rowEditor')))) {
const focusableEl = DomHandler.getFirstFocusableElement(this.$el);
focusableEl && focusableEl.focus();
}
},
beforeUnmount() {
if (this.overlayEventListener) {

View File

@ -470,6 +470,11 @@ export default {
return visibleFocusableElements;
},
getFirstFocusableElement(element) {
const focusableElements = this.getFocusableElements(element);
return focusableElements.length > 0 ? focusableElements[0] : null;
},
isClickable(element) {
const targetNode = element.nodeName;
const parentNode = element.parentElement && element.parentElement.nodeName;

View File

@ -43,6 +43,7 @@ export declare class DomHandler {
static isVisible(el: HTMLElement): boolean;
static invokeElementMethod(el: HTMLElement, methodName: string, args: any): void;
static getFocusableElements(el: HTMLElement): any[];
static getFirstFocusableElement(el: HTMLElement): any;
static isClickable(el: HTMLElement): boolean;
static applyStyle(el: HTMLElement, style: any): void;
static isIOS(): boolean;