Skip to content

Commit e0a2813

Browse files
committed
refactor(multiple): use write stage for setDefaultStateEffect across all aria directives
1 parent 964e63d commit e0a2813

6 files changed

Lines changed: 8 additions & 19 deletions

File tree

src/aria/listbox/listbox.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ export class Listbox<V> {
167167
}
168168
});
169169

170-
afterRenderEffect(() => {
171-
this._pattern.setDefaultStateEffect();
172-
});
170+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
173171

174172
// Ensure that if the active item is removed from
175173
// the list, the listbox updates it's focus state.

src/aria/menu/menu-bar.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ export class MenuBar<V> {
123123
element: computed(() => this._elementRef.nativeElement),
124124
});
125125

126-
afterRenderEffect(() => {
127-
this._pattern.setDefaultStateEffect();
128-
});
126+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
129127
}
130128

131129
/** Closes the menubar. */

src/aria/menu/menu.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ export class Menu<V> {
179179
},
180180
});
181181

182-
afterRenderEffect(() => {
183-
this._pattern.setDefaultStateEffect();
184-
});
182+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
185183
}
186184

187185
/** Closes the menu. */

src/aria/tabs/tab-list.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {Directionality} from '@angular/cdk/bidi';
1010
import {
11+
afterRenderEffect,
1112
booleanAttribute,
1213
computed,
1314
Directive,
@@ -16,7 +17,6 @@ import {
1617
input,
1718
model,
1819
signal,
19-
afterRenderEffect,
2020
OnInit,
2121
OnDestroy,
2222
} from '@angular/core';
@@ -118,9 +118,7 @@ export class TabList implements OnInit, OnDestroy {
118118
});
119119

120120
constructor() {
121-
afterRenderEffect(() => {
122-
this._pattern.setDefaultStateEffect();
123-
});
121+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
124122

125123
afterRenderEffect(() => {
126124
const tab = this._pattern.selectedTab();

src/aria/toolbar/toolbar.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ export class Toolbar<V> {
105105
});
106106

107107
constructor() {
108-
afterRenderEffect(() => {
109-
this._pattern.setDefaultStateEffect();
110-
});
108+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
111109
}
112110

113111
_register(widget: ToolbarWidget<V>) {

src/aria/tree/tree.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ export class Tree<V> {
179179
}
180180
});
181181

182-
afterRenderEffect(() => {
183-
this._pattern.setDefaultStateEffect();
184-
});
182+
// Resets default focus based on selection state until interacted.
183+
afterRenderEffect({write: () => this._pattern.setDefaultStateEffect()});
185184

186185
afterRenderEffect(() => {
187186
const items = inputs.items();

0 commit comments

Comments
 (0)