Skip to content

Commit 61d7ae0

Browse files
committed
refactor(aria/grid): Add accessors for pattern properties
1 parent 4c44304 commit 61d7ae0

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/aria/grid/grid.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import {GridPattern, GridRowPattern, GridCellPattern, GridCellWidgetPattern} fro
3030
host: {
3131
'class': 'grid',
3232
'role': 'grid',
33-
'[tabindex]': '_pattern.tabIndex()',
33+
'[tabindex]': 'tabindex()',
3434
'[attr.aria-disabled]': '_pattern.disabled()',
35-
'[attr.aria-activedescendant]': '_pattern.activeDescendant()',
35+
'[attr.aria-activedescendant]': 'activeDescendant()',
3636
'(keydown)': '_pattern.onKeydown($event)',
3737
'(pointerdown)': '_pattern.onPointerdown($event)',
3838
'(pointermove)': '_pattern.onPointermove($event)',
@@ -77,6 +77,24 @@ export class Grid {
7777
/** The wrapping behavior for keyboard navigation along the column axis. */
7878
readonly colWrap = input<'continuous' | 'loop' | 'nowrap'>('loop');
7979

80+
/** The currently active cell. */
81+
readonly activeCell = computed(() => this._pattern.activeCell());
82+
83+
/** The ID of the currently active descendant cell. */
84+
readonly activeDescendant = computed(() => this._pattern.activeDescendant());
85+
86+
/** Whether the user is currently dragging to select a range of cells. */
87+
readonly dragging = computed(() => this._pattern.dragging());
88+
89+
/** Whether the focus is in the grid. */
90+
readonly isFocused = computed(() => this._pattern.isFocused());
91+
92+
/** Whether to pause grid navigation. */
93+
readonly pauseNavigation = computed(() => this._pattern.pauseNavigation());
94+
95+
/** The tab index for the grid. */
96+
readonly tabindex = computed(() => this._pattern.tabIndex());
97+
8098
/** The UI pattern for the grid. */
8199
readonly _pattern = new GridPattern({
82100
...this,

0 commit comments

Comments
 (0)