MCPcopy Create free account
hub / github.com/angular/components / _getCellRole

Method _getCellRole

src/cdk/table/table.ts:481–491  ·  view source on GitHub ↗

Aria role to apply to the table's cells based on the table's own role.

()

Source from the content-addressed store, hash-verified

479
480 /** Aria role to apply to the table's cells based on the table's own role. */
481 _getCellRole(): string | null {
482 // Perform this lazily in case the table's role was updated by a directive after construction.
483 if (this._cellRoleInternal === undefined) {
484 // Note that we set `role="cell"` even on native `td` elements,
485 // because some browsers seem to require it. See #29784.
486 const tableRole = this._elementRef.nativeElement.getAttribute('role');
487 return tableRole === 'grid' || tableRole === 'treegrid' ? 'gridcell' : 'cell';
488 }
489
490 return this._cellRoleInternal;
491 }
492 private _cellRoleInternal: string | null | undefined = undefined;
493
494 /**

Callers 2

constructorMethod · 0.80
constructorMethod · 0.80

Calls 1

getAttributeMethod · 0.65

Tested by

no test coverage detected