tailwindcss-stimulus-components icon indicating copy to clipboard operation
tailwindcss-stimulus-components copied to clipboard

Tabs: Add support for horizontal scrolling

Open ledermann opened this issue 2 years ago • 0 comments

I'm using horizontal scrollable tabs in my current project, so the active tab may be out of sight after connecting the controller.

This PR fixes this by changing two things:

  • The active tab always gets the attribute aria-selected="true"
  • Using scrollIntoView() ensures that the active tab is visible

References:

  • https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
  • https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSelected
  • https://developer.mozilla.org/de/docs/Web/API/Element/scrollIntoView

ledermann avatar Dec 15 '21 13:12 ledermann