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

Fix: Close dropdown on Shift + Tab and enable cyclic navigation for menu items. #940

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

Conversation

sthakur-c-2-eightfold
Copy link
Contributor

@sthakur-c-2-eightfold sthakur-c-2-eightfold commented Feb 4, 2025

SUMMARY:

Toggle Dropdown on Shift+Tab Behavior & Cyclic Navigation

  • Added functionality to toggle dropdown visibility when pressing Shift + Tab.
  • Maintains existing Tab behavior while adding Shift + Tab support.
  • Provided a way to handle cyclic navigation for menu items.
  • Introduced a flag applyCyclicNavigation in the List component:
    • When set to true, cyclic navigation is enabled.
    • When false or unset, the behavior remains unchanged.

GITHUB ISSUE (Open Source Contributors)

NA

JIRA TASK (Eightfold Employees Only):

https://eightfoldai.atlassian.net/browse/ENG-118833

CHANGE TYPE:

  • Bugfix Pull Request
  • Feature Pull Request

TEST COVERAGE:

  • Tests for this change already exist
  • I have added unittests for this change

TEST PLAN:

Toggle Dropdown on Shift+Tab

  1. Pass toggleDropdownOnShiftTab ={false} to dropdown component
  2. Navigate to dropdown button
  3. Press Enter
  4. Once Dropdown appear Press Shift+Tab
  5. Observe Dropdown should close.
Screen.Recording.2025-02-04.at.5.16.08.PM.mov

Enabling Cyclic Navigation in Dropdown

  1. Pass applyCyclicNavigation={true} to the List/Menu component.
  2. Navigate to the dropdown button.
  3. Press Enter to open the dropdown.
  4. Use arrow keys to navigate through menu items.
  5. Observe that focus cycles through the dropdown menu items seamlessly.
Screen.Recording.2025-02-06.at.2.51.57.PM.mov

Copy link

codesandbox-ci bot commented Feb 4, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.48%. Comparing base (e790948) to head (e8ce6af).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/components/Dropdown/Dropdown.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #940   +/-   ##
=======================================
  Coverage   84.47%   84.48%           
=======================================
  Files        1100     1100           
  Lines       20513    20514    +1     
  Branches     7759     7760    +1     
=======================================
+ Hits        17329    17331    +2     
+ Misses       3097     3096    -1     
  Partials       87       87           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sthakur-c-2-eightfold sthakur-c-2-eightfold changed the title fix: dropdown: added prop toggleDropdownOnShiftTab to handle shift+tab toggle behaviour Fix: close dropdown on shift+tab and provide cyclic navigation for menu items Feb 6, 2025
@sthakur-c-2-eightfold sthakur-c-2-eightfold changed the title Fix: close dropdown on shift+tab and provide cyclic navigation for menu items Fix: Close dropdown on **Shift + Tab** and enable cyclic navigation for menu items. Feb 6, 2025
@sthakur-c-2-eightfold sthakur-c-2-eightfold changed the title Fix: Close dropdown on **Shift + Tab** and enable cyclic navigation for menu items. Fix: Close dropdown on Shift + Tab and enable cyclic navigation for menu items. Feb 6, 2025
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

Successfully merging this pull request may close these issues.

1 participant