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

Dynamically setting disabled state results in keyboard focus getting lost #1045

Open
2 tasks done
Chudesnov opened this issue Mar 12, 2024 · 0 comments
Open
2 tasks done

Comments

@Chudesnov
Copy link

Chudesnov commented Mar 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Code Sandbox link

https://commerce.nearform.com/open-source/nuka-carousel/

Bug report

Default navigation mode relies on disabling prev/next buttons in DOM when user reaches the first / last slide.

Dynamically setting HTML disabled on a focused element results in keyboard focus getting lost. The recommended way of managing disabled state for such widgets is using tabIndex={-1} and aria-disabled="true" instead, which doesn't affect keyboard focus.

Workarounds

  • Implement custom renderCenterLeftControls and renderCenterRightControls functions to render aria-disabled and tabIndex attributes on buttons instead of disabled, implement CSS overrides for aria-disabled
  • Use the "wrap-around" mode
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

1 participant