diff --git a/packages/grid/src/vaadin-grid-a11y-mixin.js b/packages/grid/src/vaadin-grid-a11y-mixin.js index 8fd07f673a2..d7070256356 100644 --- a/packages/grid/src/vaadin-grid-a11y-mixin.js +++ b/packages/grid/src/vaadin-grid-a11y-mixin.js @@ -22,23 +22,23 @@ export const A11yMixin = (superClass) => }; } static get observers() { - return ['_a11yUpdateGridSize(size, _columnTree)']; + return ['__a11yUpdateGridSize(size, _columnTree)']; } /** @private */ - _a11yGetHeaderRowCount(_columnTree) { + __a11yGetHeaderRowCount(_columnTree) { return _columnTree.filter((level) => level.some((col) => col.headerRenderer || (col.path && col.header !== null) || col.header), ).length; } /** @private */ - _a11yGetFooterRowCount(_columnTree) { + __a11yGetFooterRowCount(_columnTree) { return _columnTree.filter((level) => level.some((col) => col.headerRenderer)).length; } /** @private */ - _a11yUpdateGridSize(size, _columnTree) { + __a11yUpdateGridSize(size, _columnTree) { if (size === undefined || _columnTree === undefined) { return; } @@ -46,43 +46,43 @@ export const A11yMixin = (superClass) => const bodyColumns = _columnTree[_columnTree.length - 1]; this.$.table.setAttribute( 'aria-rowcount', - size + this._a11yGetHeaderRowCount(_columnTree) + this._a11yGetFooterRowCount(_columnTree), + size + this.__a11yGetHeaderRowCount(_columnTree) + this.__a11yGetFooterRowCount(_columnTree), ); this.$.table.setAttribute('aria-colcount', (bodyColumns && bodyColumns.length) || 0); - this._a11yUpdateHeaderRows(); - this._a11yUpdateFooterRows(); + this.__a11yUpdateHeaderRows(); + this.__a11yUpdateFooterRows(); } - /** @protected */ - _a11yUpdateHeaderRows() { + /** @private */ + __a11yUpdateHeaderRows() { iterateChildren(this.$.header, (headerRow, index) => { headerRow.setAttribute('aria-rowindex', index + 1); }); } - /** @protected */ - _a11yUpdateFooterRows() { + /** @private */ + __a11yUpdateFooterRows() { iterateChildren(this.$.footer, (footerRow, index) => { - footerRow.setAttribute('aria-rowindex', this._a11yGetHeaderRowCount(this._columnTree) + this.size + index + 1); + footerRow.setAttribute('aria-rowindex', this.__a11yGetHeaderRowCount(this._columnTree) + this.size + index + 1); }); } /** * @param {!HTMLElement} row * @param {number} index - * @protected + * @private */ - _a11yUpdateRowRowindex(row, index) { - row.setAttribute('aria-rowindex', index + this._a11yGetHeaderRowCount(this._columnTree) + 1); + __a11yUpdateRowRowindex(row, index) { + row.setAttribute('aria-rowindex', index + this.__a11yGetHeaderRowCount(this._columnTree) + 1); } /** * @param {!HTMLElement} row * @param {boolean} selected - * @protected + * @private */ - _a11yUpdateRowSelected(row, selected) { + __a11yUpdateRowSelected(row, selected) { // Jaws reads selection only for rows, NVDA only for cells row.setAttribute('aria-selected', Boolean(selected)); iterateRowCells(row, (cell) => { @@ -92,9 +92,9 @@ export const A11yMixin = (superClass) => /** * @param {!HTMLElement} row - * @protected + * @private */ - _a11yUpdateRowExpanded(row) { + __a11yUpdateRowExpanded(row) { if (this.__isRowExpandable(row)) { row.setAttribute('aria-expanded', 'false'); } else if (this.__isRowCollapsible(row)) { @@ -107,9 +107,9 @@ export const A11yMixin = (superClass) => /** * @param {!HTMLElement} row * @param {number} level - * @protected + * @private */ - _a11yUpdateRowLevel(row, level) { + __a11yUpdateRowLevel(row, level) { // Set level for the expandable rows itself, and all the nested rows. if (level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row)) { row.setAttribute('aria-level', level + 1); @@ -121,9 +121,9 @@ export const A11yMixin = (superClass) => /** * @param {!HTMLElement} row * @param {!HTMLElement} detailsCell - * @protected + * @private */ - _a11ySetRowDetailsCell(row, detailsCell) { + __a11ySetRowDetailsCell(row, detailsCell) { iterateRowCells(row, (cell) => { if (cell !== detailsCell) { cell.setAttribute('aria-controls', detailsCell.id); @@ -134,14 +134,14 @@ export const A11yMixin = (superClass) => /** * @param {!HTMLElement} row * @param {number} colspan - * @protected + * @private */ - _a11yUpdateCellColspan(cell, colspan) { + __a11yUpdateCellColspan(cell, colspan) { cell.setAttribute('aria-colspan', Number(colspan)); } - /** @protected */ - _a11yUpdateSorters() { + /** @private */ + __a11yUpdateSorters() { Array.from(this.querySelectorAll('vaadin-grid-sorter')).forEach((sorter) => { let cellContent = sorter.parentNode; while (cellContent && cellContent.localName !== 'vaadin-grid-cell-content') { diff --git a/packages/grid/src/vaadin-grid-column-group-mixin.js b/packages/grid/src/vaadin-grid-column-group-mixin.js index d6feb009778..f717c94b3e1 100644 --- a/packages/grid/src/vaadin-grid-column-group-mixin.js +++ b/packages/grid/src/vaadin-grid-column-group-mixin.js @@ -314,13 +314,13 @@ export const GridColumnGroupMixin = (superClass) => if (headerCell) { headerCell.setAttribute('colspan', colSpan); if (this._grid) { - this._grid._a11yUpdateCellColspan(headerCell, colSpan); + this._grid.__a11yUpdateCellColspan(headerCell, colSpan); } } if (footerCell) { footerCell.setAttribute('colspan', colSpan); if (this._grid) { - this._grid._a11yUpdateCellColspan(footerCell, colSpan); + this._grid.__a11yUpdateCellColspan(footerCell, colSpan); } } } diff --git a/packages/grid/src/vaadin-grid-mixin.js b/packages/grid/src/vaadin-grid-mixin.js index e7600efe91d..a0c45ed73e4 100644 --- a/packages/grid/src/vaadin-grid-mixin.js +++ b/packages/grid/src/vaadin-grid-mixin.js @@ -521,7 +521,7 @@ export const GridMixin = (superClass) => row.appendChild(detailsCell); // Cache the details cell reference row.__detailsCell = detailsCell; - this._a11ySetRowDetailsCell(row, detailsCell); + this.__a11ySetRowDetailsCell(row, detailsCell); detailsCell._vacant = false; } @@ -644,7 +644,7 @@ export const GridMixin = (superClass) => this._updateRowOrderParts(row, index); - this._a11yUpdateRowRowindex(row, index); + this.__a11yUpdateRowRowindex(row, index); this.__ensureRowItem(row); this.__ensureRowHierarchy(row); @@ -738,8 +738,8 @@ export const GridMixin = (superClass) => this._frozenCellsChanged(); this._updateFirstAndLastColumn(); this._resetKeyboardNavigation(); - this._a11yUpdateHeaderRows(); - this._a11yUpdateFooterRows(); + this.__a11yUpdateHeaderRows(); + this.__a11yUpdateFooterRows(); this.generateCellClassNames(); this.generateCellPartNames(); this.__updateHeaderAndFooter(); @@ -784,8 +784,8 @@ export const GridMixin = (superClass) => this._toggleDetailsCell(row, model.detailsOpened); - this._a11yUpdateRowLevel(row, model.level); - this._a11yUpdateRowSelected(row, model.selected); + this.__a11yUpdateRowLevel(row, model.level); + this.__a11yUpdateRowSelected(row, model.selected); this._updateRowStateParts(row, model); @@ -806,7 +806,7 @@ export const GridMixin = (superClass) => this._updateDetailsCellHeight(row); - this._a11yUpdateRowExpanded(row, model.expanded); + this.__a11yUpdateRowExpanded(row, model.expanded); } /** @private */ diff --git a/packages/grid/src/vaadin-grid-sort-mixin.js b/packages/grid/src/vaadin-grid-sort-mixin.js index f3dac64e147..194fc0c71dd 100644 --- a/packages/grid/src/vaadin-grid-sort-mixin.js +++ b/packages/grid/src/vaadin-grid-sort-mixin.js @@ -162,7 +162,7 @@ export const SortMixin = (superClass) => this.__debounceClearCache(); } - this._a11yUpdateSorters(); + this.__a11yUpdateSorters(); this._previousSorters = this._mapSorters(); }