react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

fix(#2592): Breadcrumbs lose focus when a breadcrumb link is clicked to become the current page

Open majornista opened this issue 3 years ago โ€ข 42 comments

Closes #2592

โœ… Pull Request Checklist:

  • [x] Included link to corresponding React Spectrum GitHub Issue 2592.
  • [x] Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • [x] Filled out test instructions.
  • [ ] Updated documentation (if it already exists for this component).
  • [x] Looked at the Accessibility Practices for this feature - Aria Practices

๐Ÿ“ Test Instructions:

  1. Open Storybook story: https://reactspectrum.blob.core.windows.net/reactspectrum/fe4b4db6bb1ee0203de7740c99dfc98985e07a8d/storybook/index.html?path=/story/breadcrumbs--dynamic-breadcrumbs-with-focus-management
  2. Move keyboard focus to one of the links preceding the current location.
  3. Activate the link to update the current location.
  4. Focus should get set to the new current location, which is a "disabled" link with aria-current and text matching the text for the link you clicked.
  5. You can reset the breadcrumbs to how they were at the start using the "Reset" button.
  6. Repeat for items within the dropdown menu.

๐Ÿงข Your Project:

Adobe/Accessibility

majornista avatar Nov 24 '21 00:11 majornista

Build successful! ๐ŸŽ‰

adobe-bot avatar Nov 24 '21 00:11 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Dec 01 '21 21:12 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Dec 20 '21 18:12 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Dec 20 '21 21:12 adobe-bot

This solution has a couple potential issues. I experimented with an alternate option in #2709 (still needs some work)

devongovett avatar Dec 23 '21 20:12 devongovett

Build successful! ๐ŸŽ‰

adobe-bot avatar Jan 05 '22 19:01 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Jan 05 '22 20:01 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Jan 15 '22 00:01 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Jan 31 '22 18:01 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Feb 03 '22 22:02 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Feb 15 '22 17:02 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Feb 15 '22 22:02 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Feb 18 '22 20:02 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Mar 21 '22 13:03 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 11 '22 16:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 22 '22 13:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 25 '22 17:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 25 '22 18:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 28 '22 18:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 29 '22 00:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 29 '22 13:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 29 '22 15:04 adobe-bot

Functionality seems good to me, but what if the user wants to move focus somewhere else onAction?

@LFDanLu I think I may have been able to resolve this with 5f51eb50af7ab23c41f9176fc7bb530ff7e2bdb9.

majornista avatar Apr 29 '22 18:04 majornista

Build successful! ๐ŸŽ‰

adobe-bot avatar Apr 29 '22 18:04 adobe-bot

Build successful! ๐ŸŽ‰

adobe-bot avatar May 05 '22 00:05 adobe-bot

Just a heads up. I looked this over, something about it still doesn't sit right with me. I attempted to make it more like useSelect, however, I was unable to get it working. Will have to come back to it again.

I tried to do something similar to useSelect as well, but I think Breadcrumbs are a somewhat different case, because whether the focus is within the Breadcrumbs will be true when focus lands on a BreadcrumbItem itself, or when focus is within the Dropdown menu. The only case where the current BreadcrumbItem should need to focus itself is after selecting an item from the menu; the React key takes care of maintaining focus otherwise. If you close the menu without selecting anything, focus should restore the action menu button.

majornista avatar May 06 '22 21:05 majornista

Build successful! ๐ŸŽ‰

adobe-bot avatar May 17 '22 23:05 adobe-bot