Search code examples
frontendnpm-installangular-cdk

Want to implement cdkTrapFocus but it doesn't work


Installed angular/cdk using npm install --save @angular/cdk than imported import {A11yModule} from '@angular/cdk/a11y'; to app.module file. Tried to use in simple div

<div cdkTrapFocus>
   <button>1</button>
   <button>2 </button>
   <button>3 </button>
</div>

but it not work tried to find more information in internet, but as I see for examples people are using same cdkTrapFocus directive in div


Solution

  • I found why for me It doesn't worked I had several modules like app.module, shared.module, component.module and for some reason my import in shared module which I import later in to app.module was not working, so I tried to import that to component.module and then It started to work.