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

Method _getCellRole

src/cdk/table/table.ts:475–485  ·  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

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

Callers 2

constructorMethod · 0.80
constructorMethod · 0.80

Calls 1

getAttributeMethod · 0.65

Tested by

no test coverage detected