Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pFocusTrap: focus stuck when ancestor of tabbable element is hidden #12349

Closed
mmorgan4x opened this issue Dec 7, 2022 · 3 comments · Fixed by #12402 or #12453
Closed

pFocusTrap: focus stuck when ancestor of tabbable element is hidden #12349

mmorgan4x opened this issue Dec 7, 2022 · 3 comments · Fixed by #12402 or #12453
Labels
LTS-FIXED-14.2.7 LTS-PORTABLE Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@mmorgan4x
Copy link
Contributor

mmorgan4x commented Dec 7, 2022

Describe the bug

When tabbing through focusable elements in pFocusTrap, focus will get stuck prior to a tabbable element whose ancestor is display:none.

Environment

Chrome

Reproducer

https://stackblitz.com/edit/github-qrz39t?file=src/app/app.component.html

Angular version

14.0.7

PrimeNG version

15.0.0-rc.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

n/a

Browser(s)

chrome

Steps to reproduce the behavior

Focus on button 2. Hit tab to go to next element. Notice how focus is stuck.

Expected behavior

Focus should go to button 4.

@mmorgan4x mmorgan4x added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 7, 2022
@mmorgan4x
Copy link
Contributor Author

here is my SCSS polyfill when using bootstrap5 display utilities to hide

$displays: inline inline-block block grid table table-cell table-row flex inline-flex;
$tabbable: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]';

@function d-size($size) {
    $ret: ();
    @each $n in $displays {
       $ret: append($ret,'.d-'+$size+'-'+$n,'comma');
    }
    @return $ret;
}

.d-none:not(#{d-size('sm')},#{d-size('md')},#{d-size('lg')},#{d-size('xl')}) *:is(#{$tabbable}),
.d-sm-none:not(#{d-size('md')},#{d-size('lg')},#{d-size('xl')}) *:is(#{$tabbable}),
.d-md-none:not(#{d-size('lg')},#{d-size('xl')}) *:is(#{$tabbable}),
.d-lg-none:not(#{d-size('xl')}) *:is(#{$tabbable}),
.d-xl-none *:is(#{$tabbable})
{
  display: none !important; 
}

@mmorgan4x
Copy link
Contributor Author

PR #12402

@cetincakiroglu cetincakiroglu added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Dec 20, 2022
@cetincakiroglu cetincakiroglu modified the milestones: 15.Future, 15.0.1 Dec 20, 2022
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 28, 2022
cetincakiroglu added a commit that referenced this issue Dec 28, 2022
#12349 focus trap breaking on elements whose ancestors are hidden
cetincakiroglu added a commit that referenced this issue Dec 28, 2022
Revert "#12349 focus trap breaking on elements whose ancestors are hidden"
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 28, 2022
@cetincakiroglu cetincakiroglu modified the milestones: 15.0.1, 15.Future, 15.0.2 Jan 2, 2023
@mmorgan4x
Copy link
Contributor Author

PR #12453

cetincakiroglu added a commit that referenced this issue Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-FIXED-14.2.7 LTS-PORTABLE Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
3 participants