Skip to content

Commit f380209

Browse files
committed
fix(multiple): expose active from public api (#32330)
(cherry picked from commit e03a0dc)
1 parent 09e31e7 commit f380209

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/aria/grid/grid.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class GridRow {
236236
'[attr.id]': '_pattern.id()',
237237
'[attr.rowspan]': '_pattern.rowSpan()',
238238
'[attr.colspan]': '_pattern.colSpan()',
239-
'[attr.data-active]': '_pattern.active()',
239+
'[attr.data-active]': 'active()',
240240
'[attr.data-anchor]': '_pattern.anchor()',
241241
'[attr.aria-disabled]': '_pattern.disabled()',
242242
'[attr.aria-rowspan]': '_pattern.rowSpan()',
@@ -254,6 +254,9 @@ export class GridCell {
254254
/** A reference to the host element. */
255255
readonly element = this._elementRef.nativeElement as HTMLElement;
256256

257+
/** Whether the cell is currently active (focused). */
258+
readonly active = computed(() => this._pattern.active());
259+
257260
/** The widgets contained within this cell, if any. */
258261
private readonly _widgets = contentChildren(GridCellWidget, {descendants: true});
259262

@@ -362,7 +365,7 @@ export class GridCell {
362365
exportAs: 'ngGridCellWidget',
363366
host: {
364367
'class': 'grid-cell-widget',
365-
'[attr.data-active]': '_pattern.active()',
368+
'[attr.data-active]': 'active()',
366369
'[attr.data-active-control]': 'isActivated() ? "widget" : "cell"',
367370
'[tabindex]': '_tabIndex()',
368371
},
@@ -374,6 +377,9 @@ export class GridCellWidget {
374377
/** A reference to the host element. */
375378
readonly element = this._elementRef.nativeElement as HTMLElement;
376379

380+
/** Whether the widget is currently active (focused). */
381+
readonly active = computed(() => this._pattern.active());
382+
377383
/** The parent cell. */
378384
private readonly _cell = inject(GridCell);
379385

src/aria/listbox/listbox.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export class Listbox<V> {
228228
exportAs: 'ngOption',
229229
host: {
230230
'role': 'option',
231-
'[attr.data-active]': '_pattern.active()',
231+
'[attr.data-active]': 'active()',
232232
'[attr.id]': '_pattern.id()',
233233
'[attr.tabindex]': '_pattern.tabIndex()',
234234
'[attr.aria-selected]': '_pattern.selected()',
@@ -242,6 +242,9 @@ export class Option<V> {
242242
/** A reference to the host element. */
243243
readonly element = this._elementRef.nativeElement as HTMLElement;
244244

245+
/** Whether the option is currently active (focused). */
246+
active = computed(() => this._pattern.active());
247+
245248
/** The parent Listbox. */
246249
private readonly _listbox = inject(Listbox);
247250

0 commit comments

Comments
 (0)