angular-mentions icon indicating copy to clipboard operation
angular-mentions copied to clipboard

Clicking scrollbar closes mention list when in MatDialog

Open vadimooo opened this issue 6 years ago • 10 comments
trafficstars

Trying to use scroll bar in open mention list closes the list. This happens when trying to click up/down arrows or drag the scrollbar. I'm using latest version with Chrome browser.

vadimooo avatar Jul 09 '19 17:07 vadimooo

I'm unable to reproduce this. Is anyone else having the same issue?

dmacfarlane avatar Jul 09 '19 17:07 dmacfarlane

Thank you for quick response! I was able to narrow it down - issue only happens when using the component in MatDialog. Something to do with z-index? Any suggestions are much appreciated!

vadimooo avatar Jul 10 '19 17:07 vadimooo

This also happens when clicking on an option from within a bootstrap modal.

patch321 avatar Aug 07 '19 13:08 patch321

I'm also facing this issue, our product is nearing production any help will be very much appreciated.!!!!

JerinJ avatar Jan 15 '20 12:01 JerinJ

I am also facing this issue. I have tested and sure that this issue happens only when textarea resides inside <mat-sidenav>.

architgarg avatar Jan 30 '20 13:01 architgarg

I dug into it and found out this happens when there is tabindex="-1" applied to any parent element.

Since bootstrap modal, matDialog, matSidenav all these components use tabindex="-1" that's why issue happens only in these cases. Though it is not a perfect fix, but I fixed this by removing tabindex like so: (this could not be the ideal solution for everyone, since tabindex="-1" is there for a reason, please do your research before modifying tabindex)

Before:

<mat-sidenav ... > ... </mat-sidenav>

After - added tabindex attribute which removed tabindex="-1" in the dom.

<mat-sidenav tabindex ... > ... </mat-sidenav>

architgarg avatar Jan 31 '20 09:01 architgarg

Hello, issue with scroll bar is still present even when using contenteditable

isviridov-web avatar Apr 28 '20 08:04 isviridov-web

This also happens in kendo-dialog, then I remove tabindex like architgarg and it works. Thank you.

hvqthong avatar Sep 23 '21 03:09 hvqthong

Any Fix for this issue?

rajsync avatar Nov 30 '23 22:11 rajsync

I fixed it by below hack by removing tabindex and it works fine: In my component:

import { MatDialog, MatDialogRef } from '@angular/material/dialog';

constructor(
    public dialogRef: MatDialogRef<MatDialog>, 
    ...
) { }

ngOnInit(): void {
    this.dialogRef._containerInstance['_elementRef']?.nativeElement.setAttribute('tabindex', '');
    ...
}

pareshtrivedi avatar Jan 04 '24 17:01 pareshtrivedi