Topic: MdbScrollbar in MdbSidenav make input unable to get focus correctly

axiame_studio priority asked 10 months ago


*Expected behavior*Hello, we noticied that in our project, if the scrollbar of the left sidenav get activated then we cannot get focus anymore on the input within our app (the label go up in the input but the cursor is not present and we cannot enter any text)

*Actual behavior*Our project is structured as such:

<header>
  <nav>
     ...
  </nav>
</header>
<mdb-sidenav-layout>
  <mdb-sidenav #sidenav="mdbSidenav" mode="over" [slimWidth]="55">
    ...menu here...
  </mdb-sidenav>
  <mdb-sidenav mode="over" [right]="true" [width]="300" [backdrop]="false [focusTrap]="false">
  </mdb-sidenav>
  <mdb-sidenav-content>
   <router-outlet></router-outlet>
  </mdb-sidenav-content>
</mdb-sidenav-layout>

If there is a scrollbar in the left sidenav, at the moment we use it and scrolldown then all the input in the rest of the app cannot get the focus (it acts as if it get the focus but the cursor is not in the input and therefore we cannot write text in the input)

The workarounds possible to solve this are: - to place all the content of the left sidenav in a div with a fixed height and an overflow-y: auto. This will prevent the madScrollbar from ever been activated.We also noticed that this behavior only happen when the sidenav is left positioned and with mode over. It also only activate when the mdb-scollbar is used and that we close the sidenav while scrolldowned, it doesn't occurs if we don't scroll down in the left sidenav. - to add the attribute [focusTrap]="false" to the left sidenav

I'm sorry if my description is not well written, please don't hesitate to contact me if you need some clarifications.

Resources (screenshots, code snippets etc.)


Rafał Seifert staff commented 10 months ago

Locking focus on sidenav in over mode is correct behaviour. [focusTrap]="false" input lets you change that. If that does not solve your issue then please provide us with more detailed code so we can recreate the scenario with inputs and the usage of mdbScrollbar.


axiame_studio priority commented 10 months ago

Is it the expected behavior even once the sidenav is hidden? In my case what happened is that even if we hide the sidenav, all inputs cannot get correct focus. The behavior of inputs is strange, it still get the focus as the label of the mat-input move to the top of the input, but the cursor is not set in the input.


Arkadiusz Idzikowski staff commented 10 months ago

Could you please edit your post and provide more detailed code example? It would be much easier to reproduce this problem on our end and check if everything is working correctly.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 5.0.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No