primeng icon indicating copy to clipboard operation
primeng copied to clipboard

FocusTrap for Dialog

Open AndreaBarbasso opened this issue 9 years ago • 2 comments

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior When you open a dialog - or even a modal - and tab through its elements, you end up focusing elements in the background when there are no more focusable elements in the dialog itself.

Expected behavior Tabbing inside a dialog should cycle only on elements inside the dialog. For example, Angular Material's FocusTrap does it. Also, opening a dialog should focus its first focusable element, and closing it should focus whatever element in the background was focused before opening.

What is the motivation / use case for changing the behavior? Avoiding unexpected behaviour, giving logic consistency.

AndreaBarbasso avatar Nov 27 '17 14:11 AndreaBarbasso

btw, i'm using import {A11yModule} from '@angular/cdk/a11y'; from Material in my PNG project and in dialog content <div class="my-inner-dialog-content" cdkTrapFocus> works great! Disadvantage, of course, increased bundle size, but this

Avoiding unexpected behaviour, giving logic consistency

TishchenkoAlex avatar Nov 28 '17 14:11 TishchenkoAlex

Has this been implemented? Facing this issue in PrimeNG v6 as well.

bhuvhi avatar Mar 03 '19 23:03 bhuvhi