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

Dialog: Disables tabbbing of inputs #4035

Closed
on2air opened this issue Feb 9, 2023 · 5 comments
Closed

Dialog: Disables tabbbing of inputs #4035

on2air opened this issue Feb 9, 2023 · 5 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add

Comments

@on2air
Copy link

on2air commented Feb 9, 2023

Describe the bug

When using a Dialog it disables the ability to tab between input fields.

Reproducer

https://codesandbox.io/s/primereact-demo-forked-b9vdp1?file=/src/demo.js:714-719

PrimeReact version

8

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome

Steps to reproduce the behavior

See code. If the dialog is not shown, then you can tab between the input fields. Once you show the dialog (by clicking the button) then tabbing is disabled.

I'm using the Dialog in this way as a permanent floating banner in upper right of page, everything is fine except tabbing no longer works on my form.

Expected behavior

Tabbing should work as expected when dialog is visible (same as if its not visible)

@on2air on2air added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 9, 2023
@melloware melloware changed the title Component: Title Dialog: Disables tabbbing of inputs Feb 9, 2023
@melloware
Copy link
Member

This is on purpose. When a Dialog is open its to keep Tabbing containment inside the dialog.

else if (event.key === 'Tab') {
            event.preventDefault();
            const focusableElements = DomHandler.getFocusableElements(dialog);

            if (focusableElements && focusableElements.length > 0) {
                if (!document.activeElement) {
                    focusableElements[0].focus();
                } else {
                    const focusedIndex = focusableElements.indexOf(document.activeElement);

                    if (event.shiftKey) {
                        if (focusedIndex === -1 || focusedIndex === 0) focusableElements[focusableElements.length - 1].focus();
                        else focusableElements[focusedIndex - 1].focus();
                    } else {
                        if (focusedIndex === -1 || focusedIndex === focusableElements.length - 1) focusableElements[0].focus();
                        else focusableElements[focusedIndex + 1].focus();
                    }
                }
            }
        }

I think a new property to allow Tabbing will be needed to turn this behavior off.

@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 9, 2023
@on2air
Copy link
Author

on2air commented Feb 9, 2023

I see. that would make sense. yes a way to disable would be great. in the meantime, I didn't see another component that could be used as sort of a floating message/banner, is there? if not I can look outside of prime.

@melloware
Copy link
Member

I don't think there is anything in PR that will do exactly what you want until this issue is fixed.

@on2air
Copy link
Author

on2air commented Feb 9, 2023

I was able to use the Toast component for my needs and that allows tabbing.

@melloware
Copy link
Member

Going to close this feature as Dialog Accessibility is the goal and keeping the focus in the Dialog is ARIA compliant.

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
@melloware melloware removed this from the 10.6.4 milestone Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

2 participants