@@ -158,44 +158,29 @@ export class AccordionTriggerPattern {
158
158
/** The pointerdown event manager for the accordion trigger. */
159
159
pointerdown = computed ( ( ) => {
160
160
return new PointerEventManager ( ) . on ( e => {
161
- const item = this . _getItem ( e ) ;
162
-
163
- if ( item ) {
164
- this . accordionGroup ( ) . navigation . goto ( item ) ;
165
- this . expansionControl . toggle ( ) ;
166
- }
161
+ this . accordionGroup ( ) . navigation . goto ( this ) ;
162
+ this . expansionControl . toggle ( ) ;
167
163
} ) ;
168
164
} ) ;
169
165
170
166
/** Handles keydown events on the trigger, delegating to the group if not disabled. */
171
- onKeydown ( event : KeyboardEvent ) : void {
167
+ onKeydown ( event : KeyboardEvent ) {
172
168
this . keydown ( ) . handle ( event ) ;
173
169
}
174
170
175
171
/** Handles pointerdown events on the trigger, delegating to the group if not disabled. */
176
- onPointerdown ( event : PointerEvent ) : void {
172
+ onPointerdown ( event : PointerEvent ) {
177
173
this . pointerdown ( ) . handle ( event ) ;
178
174
}
179
175
180
176
/** Handles focus events on the trigger. This ensures the tabbing changes the active index. */
181
- onFocus ( event : FocusEvent ) : void {
182
- const item = this . _getItem ( event ) ;
177
+ onFocus ( ) {
178
+ if ( this . disabled ( ) && this . accordionGroup ( ) . skipDisabled ( ) ) return ;
183
179
184
- if ( item && this . inputs . accordionGroup ( ) . focusManager . isFocusable ( item ) ) {
185
- this . accordionGroup ( ) . focusManager . focus ( item ) ;
180
+ if ( this . inputs . accordionGroup ( ) . focusManager . isFocusable ( this ) ) {
181
+ this . accordionGroup ( ) . focusManager . focus ( this ) ;
186
182
}
187
183
}
188
-
189
- private _getItem ( e : Event ) {
190
- if ( ! ( e . target instanceof HTMLElement ) ) {
191
- return ;
192
- }
193
-
194
- const element = e . target . closest ( '[role="button"]' ) ;
195
- return this . accordionGroup ( )
196
- . items ( )
197
- . find ( i => i . element ( ) === element ) ;
198
- }
199
184
}
200
185
201
186
/** Represents the required inputs for the AccordionPanelPattern. */
0 commit comments