@@ -12,7 +12,6 @@ import { styleMap } from 'lit/directives/style-map.js';
1212import { themes } from '../../theming/theming-decorator.js' ;
1313import IgcButtonComponent from '../button/button.js' ;
1414import { carouselContext } from '../common/context.js' ;
15- import { addKeyboardFocusRing } from '../common/controllers/focus-ring.js' ;
1615import {
1716 type SwipeEvent ,
1817 addGesturesController ,
@@ -105,12 +104,12 @@ export default class IgcCarouselComponent extends EventEmitterMixin<
105104
106105 private static readonly increment = createCounter ( ) ;
107106 private readonly _carouselId = `igc-carousel-${ IgcCarouselComponent . increment ( ) } ` ;
108- private readonly _focusRingManager = addKeyboardFocusRing ( this ) ;
109107
110108 private readonly _internals : ElementInternals ;
111109 private _lastInterval ! : ReturnType < typeof setInterval > | null ;
112110 private _hasKeyboardInteractionOnIndicators = false ;
113111 private _hasMouseStop = false ;
112+ private _hasInnerFocus = false ;
114113
115114 private _context = new ContextProvider ( this , {
116115 context : carouselContext ,
@@ -328,6 +327,13 @@ export default class IgcCarouselComponent extends EventEmitterMixin<
328327
329328 this . addEventListener ( 'pointerenter' , this . handlePointerEnter ) ;
330329 this . addEventListener ( 'pointerleave' , this . handlePointerLeave ) ;
330+ this . addEventListener ( 'pointerdown' , ( ) => {
331+ this . _hasInnerFocus = false ;
332+ } ) ;
333+
334+ this . addEventListener ( 'keyup' , ( ) => {
335+ this . _hasInnerFocus = true ;
336+ } ) ;
331337
332338 addGesturesController ( this , {
333339 ref : this . _carouselSlidesContainerRef ,
@@ -382,22 +388,22 @@ export default class IgcCarouselComponent extends EventEmitterMixin<
382388
383389 private handlePointerEnter ( ) : void {
384390 this . _hasMouseStop = true ;
385- if ( this . _focusRingManager . focused ) {
391+ if ( this . _hasInnerFocus ) {
386392 return ;
387393 }
388394 this . handlePauseOnInteraction ( ) ;
389395 }
390396
391397 private handlePointerLeave ( ) : void {
392398 this . _hasMouseStop = false ;
393- if ( this . _focusRingManager . focused ) {
399+ if ( this . _hasInnerFocus ) {
394400 return ;
395401 }
396402 this . handlePauseOnInteraction ( ) ;
397403 }
398404
399405 private handleFocusIn ( ) : void {
400- if ( this . _focusRingManager . focused || this . _hasMouseStop ) {
406+ if ( this . _hasInnerFocus || this . _hasMouseStop ) {
401407 return ;
402408 }
403409 this . handlePauseOnInteraction ( ) ;
@@ -410,8 +416,12 @@ export default class IgcCarouselComponent extends EventEmitterMixin<
410416 return ;
411417 }
412418
413- if ( this . _focusRingManager . focused && ! this . _hasMouseStop ) {
414- this . handlePauseOnInteraction ( ) ;
419+ if ( this . _hasInnerFocus ) {
420+ this . _hasInnerFocus = false ;
421+
422+ if ( ! this . _hasMouseStop ) {
423+ this . handlePauseOnInteraction ( ) ;
424+ }
415425 }
416426 }
417427
0 commit comments