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

Dropdown: Allow cycling inside #38828

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented Jun 26, 2023

Description

Add cycling for the dropdown menu using arrow up and arrown down. I wonder if this should be deactivated by default and activated by an option or not (feels weird using it on a nested dropdown for example) 🤔 Or if, as it's an option, we shouldn't add it at all ?

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li>
      <button class="dropdown-item dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
        Dropdown button
      </button>
      <ul class="dropdown-menu">
        <li><a class="dropdown-item" href="#">Action</a></li>
        <li><a class="dropdown-item" href="#">Another action</a></li>
        <li><a class="dropdown-item" href="#">Something else here</a></li>
      </ul>
    </li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

Motivation & Context

It is mentionned by https://www.w3.org/WAI/ARIA/apg/patterns/menubar/ as optional.

Couldn't find any information in older PRs.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

Closes #38801.

@patrickhlauke
Copy link
Member

👀

@XhmikosR XhmikosR requested a review from GeoSot June 27, 2023 04:45
Copy link
Member

@patrickhlauke patrickhlauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, and think it would be good to have it as a default. potentially with an option to opt out?

@julien-deramond
Copy link
Member

Accessibility by default, I like that :)
If possible, would be nice to add some unit tests here just to be sure that no regressions appear in the future (with and without the option).

@XhmikosR XhmikosR changed the title Dropdown: Adding cycling inside Dropdown: Allow cycling inside Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DP Aria for the dropdowns
4 participants