Skip to content

Commit a809794

Browse files
authored
refactor!: mark A11yMixin methods as private (#9718)
1 parent f6da15c commit a809794

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

packages/grid/src/vaadin-grid-a11y-mixin.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,73 +22,74 @@ export const A11yMixin = (superClass) =>
2222
};
2323
}
2424
static get observers() {
25-
return ['_a11yUpdateGridSize(size, _columnTree, __emptyState)'];
25+
return ['__a11yUpdateGridSize(size, _columnTree, __emptyState)'];
2626
}
2727

2828
/** @private */
29-
_a11yGetHeaderRowCount(_columnTree) {
29+
__a11yGetHeaderRowCount(_columnTree) {
3030
return _columnTree.filter((level) =>
3131
level.some((col) => col.headerRenderer || (col.path && col.header !== null) || col.header),
3232
).length;
3333
}
3434

3535
/** @private */
36-
_a11yGetFooterRowCount(_columnTree) {
36+
__a11yGetFooterRowCount(_columnTree) {
3737
return _columnTree.filter((level) => level.some((col) => col.footerRenderer)).length;
3838
}
3939

4040
/** @private */
41-
_a11yUpdateGridSize(size, _columnTree, emptyState) {
41+
__a11yUpdateGridSize(size, _columnTree, emptyState) {
4242
if (size === undefined || _columnTree === undefined) {
4343
return;
4444
}
4545

46-
const headerRowsCount = this._a11yGetHeaderRowCount(_columnTree);
47-
const footerRowsCount = this._a11yGetFooterRowCount(_columnTree);
46+
const headerRowsCount = this.__a11yGetHeaderRowCount(_columnTree);
47+
const footerRowsCount = this.__a11yGetFooterRowCount(_columnTree);
4848
const bodyRowsCount = emptyState ? 1 : size;
4949
const rowsCount = bodyRowsCount + headerRowsCount + footerRowsCount;
5050

5151
this.$.table.setAttribute('aria-rowcount', rowsCount);
5252

5353
const bodyColumns = _columnTree[_columnTree.length - 1];
54+
5455
// If no header and footer rows while the empty state is active, count as one column
5556
// Otherwise, use the number of body columns, if present
5657
const columnsCount = emptyState ? 1 : (rowsCount && bodyColumns && bodyColumns.length) || 0;
5758
this.$.table.setAttribute('aria-colcount', columnsCount);
5859

59-
this._a11yUpdateHeaderRows();
60-
this._a11yUpdateFooterRows();
60+
this.__a11yUpdateHeaderRows();
61+
this.__a11yUpdateFooterRows();
6162
}
6263

63-
/** @protected */
64-
_a11yUpdateHeaderRows() {
64+
/** @private */
65+
__a11yUpdateHeaderRows() {
6566
iterateChildren(this.$.header, (headerRow, index) => {
6667
headerRow.setAttribute('aria-rowindex', index + 1);
6768
});
6869
}
6970

70-
/** @protected */
71-
_a11yUpdateFooterRows() {
71+
/** @private */
72+
__a11yUpdateFooterRows() {
7273
iterateChildren(this.$.footer, (footerRow, index) => {
73-
footerRow.setAttribute('aria-rowindex', this._a11yGetHeaderRowCount(this._columnTree) + this.size + index + 1);
74+
footerRow.setAttribute('aria-rowindex', this.__a11yGetHeaderRowCount(this._columnTree) + this.size + index + 1);
7475
});
7576
}
7677

7778
/**
7879
* @param {!HTMLElement} row
7980
* @param {number} index
80-
* @protected
81+
* @private
8182
*/
82-
_a11yUpdateRowRowindex(row, index) {
83-
row.setAttribute('aria-rowindex', index + this._a11yGetHeaderRowCount(this._columnTree) + 1);
83+
__a11yUpdateRowRowindex(row, index) {
84+
row.setAttribute('aria-rowindex', index + this.__a11yGetHeaderRowCount(this._columnTree) + 1);
8485
}
8586

8687
/**
8788
* @param {!HTMLElement} row
8889
* @param {boolean} selected
89-
* @protected
90+
* @private
9091
*/
91-
_a11yUpdateRowSelected(row, selected) {
92+
__a11yUpdateRowSelected(row, selected) {
9293
// Jaws reads selection only for rows, NVDA only for cells
9394
row.setAttribute('aria-selected', Boolean(selected));
9495
iterateRowCells(row, (cell) => {
@@ -98,9 +99,9 @@ export const A11yMixin = (superClass) =>
9899

99100
/**
100101
* @param {!HTMLElement} row
101-
* @protected
102+
* @private
102103
*/
103-
_a11yUpdateRowExpanded(row) {
104+
__a11yUpdateRowExpanded(row) {
104105
const toggleCell = findTreeToggleCell(row);
105106
if (this.__isRowExpandable(row)) {
106107
row.setAttribute('aria-expanded', 'false');
@@ -123,9 +124,9 @@ export const A11yMixin = (superClass) =>
123124
/**
124125
* @param {!HTMLElement} row
125126
* @param {number} level
126-
* @protected
127+
* @private
127128
*/
128-
_a11yUpdateRowLevel(row, level) {
129+
__a11yUpdateRowLevel(row, level) {
129130
// Set level for the expandable rows itself, and all the nested rows.
130131
if (level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row)) {
131132
row.setAttribute('aria-level', level + 1);
@@ -137,9 +138,9 @@ export const A11yMixin = (superClass) =>
137138
/**
138139
* @param {!HTMLElement} row
139140
* @param {!HTMLElement} detailsCell
140-
* @protected
141+
* @private
141142
*/
142-
_a11ySetRowDetailsCell(row, detailsCell) {
143+
__a11ySetRowDetailsCell(row, detailsCell) {
143144
iterateRowCells(row, (cell) => {
144145
if (cell !== detailsCell) {
145146
cell.setAttribute('aria-controls', detailsCell.id);
@@ -150,14 +151,14 @@ export const A11yMixin = (superClass) =>
150151
/**
151152
* @param {!HTMLElement} cell
152153
* @param {number} colspan
153-
* @protected
154+
* @private
154155
*/
155-
_a11yUpdateCellColspan(cell, colspan) {
156+
__a11yUpdateCellColspan(cell, colspan) {
156157
cell.setAttribute('aria-colspan', Number(colspan));
157158
}
158159

159-
/** @protected */
160-
_a11yUpdateSorters() {
160+
/** @private */
161+
__a11yUpdateSorters() {
161162
Array.from(this.querySelectorAll('vaadin-grid-sorter')).forEach((sorter) => {
162163
let cellContent = sorter.parentNode;
163164
while (cellContent && cellContent.localName !== 'vaadin-grid-cell-content') {

packages/grid/src/vaadin-grid-column-group-mixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ export const GridColumnGroupMixin = (superClass) =>
314314
if (headerCell) {
315315
headerCell.setAttribute('colspan', colSpan);
316316
if (this._grid) {
317-
this._grid._a11yUpdateCellColspan(headerCell, colSpan);
317+
this._grid.__a11yUpdateCellColspan(headerCell, colSpan);
318318
}
319319
}
320320
if (footerCell) {
321321
footerCell.setAttribute('colspan', colSpan);
322322
if (this._grid) {
323-
this._grid._a11yUpdateCellColspan(footerCell, colSpan);
323+
this._grid.__a11yUpdateCellColspan(footerCell, colSpan);
324324
}
325325
}
326326
}

packages/grid/src/vaadin-grid-mixin.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export const GridMixin = (superClass) =>
532532
row.appendChild(detailsCell);
533533
// Cache the details cell reference
534534
row.__detailsCell = detailsCell;
535-
this._a11ySetRowDetailsCell(row, detailsCell);
535+
this.__a11ySetRowDetailsCell(row, detailsCell);
536536
detailsCell._vacant = false;
537537
}
538538

@@ -649,7 +649,7 @@ export const GridMixin = (superClass) =>
649649

650650
// Make sure the section has a tabbable element
651651
this._resetKeyboardNavigation();
652-
this._a11yUpdateGridSize(this.size, this._columnTree, this.__emptyState);
652+
this.__a11yUpdateGridSize(this.size, this._columnTree, this.__emptyState);
653653
}
654654

655655
/** @private */
@@ -664,7 +664,7 @@ export const GridMixin = (superClass) =>
664664

665665
this._updateRowOrderParts(row, index);
666666

667-
this._a11yUpdateRowRowindex(row, index);
667+
this.__a11yUpdateRowRowindex(row, index);
668668

669669
this.__ensureRowItem(row);
670670
this.__ensureRowHierarchy(row);
@@ -758,8 +758,8 @@ export const GridMixin = (superClass) =>
758758
this._frozenCellsChanged();
759759
this._updateFirstAndLastColumn();
760760
this._resetKeyboardNavigation();
761-
this._a11yUpdateHeaderRows();
762-
this._a11yUpdateFooterRows();
761+
this.__a11yUpdateHeaderRows();
762+
this.__a11yUpdateFooterRows();
763763
this.generateCellClassNames();
764764
this.generateCellPartNames();
765765
this.__updateHeaderAndFooter();
@@ -804,8 +804,8 @@ export const GridMixin = (superClass) =>
804804

805805
this._toggleDetailsCell(row, model.detailsOpened);
806806

807-
this._a11yUpdateRowLevel(row, model.level);
808-
this._a11yUpdateRowSelected(row, model.selected);
807+
this.__a11yUpdateRowLevel(row, model.level);
808+
this.__a11yUpdateRowSelected(row, model.selected);
809809

810810
this._updateRowStateParts(row, model);
811811

@@ -826,7 +826,7 @@ export const GridMixin = (superClass) =>
826826

827827
this._updateDetailsCellHeight(row);
828828

829-
this._a11yUpdateRowExpanded(row, model.expanded);
829+
this.__a11yUpdateRowExpanded(row, model.expanded);
830830
}
831831

832832
/** @private */

packages/grid/src/vaadin-grid-sort-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const SortMixin = (superClass) =>
162162
this.__debounceClearCache();
163163
}
164164

165-
this._a11yUpdateSorters();
165+
this.__a11yUpdateSorters();
166166

167167
this._previousSorters = this._mapSorters();
168168
}

0 commit comments

Comments
 (0)