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

Elements on non-active views should not be focusable with tabbing #643

Open
1 task done
aloverso opened this issue Apr 22, 2021 · 3 comments
Open
1 task done

Elements on non-active views should not be focusable with tabbing #643

aloverso opened this issue Apr 22, 2021 · 3 comments

Comments

@aloverso
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

When a view is active, it should not allow keyboard-navigation tabbing to focus elements on other, non-visible views.

Current Behavior

When I have focusable elements in my views (such as form elements), it lets me tab-focus into these elements despite being unable to see/interact with them.

Steps to Reproduce (for bugs)

  1. Code sandbox link
  2. Open the browser console
  3. Attempt to tab through the elements on the page
  4. Observe that the tab focus is focusing elements that should be "non-existent" because they are not on the current active view

Context

I'm using swipeable-views to animate pages of a form. Due to this bug, the form is not accessible to a user who is using keyboard-only nav because they keyboard focus winds up on elements that are not visible or interactable on the page

@kmsarsam
Copy link

I believe this is the underlying issue behind #636

@kmsarsam
Copy link

You can get around this if you keep track of the index you are using, and use that index in the slideRenderer function to conditionally set the style of the slide based on whether the index is the active one. For example,

 const slideRenderer = ({index, key}: SlideRenderProps) => (
    <div key={key} style={index !== activeStep ? {display: 'none'} : {width: '100%'}}>
...

@rajatjyotishi
Copy link

@aloverso Add the following to the classname of or its parent. This will resolve the issue.

"& div[aria-hidden='true']": {
			visibility: 'hidden'
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants