-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Multiple tab stops inside collection components #7121
Comments
Thanks for the feedback. I can provide the starting information: What patterns are we currently supporting? Each component and hook page in our docs generally has a link to the Aria pattern we have implemented. For tables, that's data grid |
I think the |
@snowystinger Thanks for referencing the grid pattern here. Our team only looked at the appropriate patterns of Accordion and Carousel, so we totally missed that there is an edit mode applied not only for input content but all complex content. This mode seems to be what we are looking for! We implemented both I figure the focus is meant to be restored accordingly when re-entering the cell? Any idea how interfering Are there concrete plans or API spec to get this mode into react-aria? We could maybe provide a draft here after adjusting our keyboard control slightly and assessing how much work it is to port everything to react-aria naming and style. |
@devongovett Unfortunately On this note, I have a question: In case edit mode is added to |
Do you happen to have a example/reproduction you can share with us? The team is having a bit of a hard time understanding the exact behavior here.
Accordion and Carousel would not use edit mode I imagine, were you imagining a case where those components would use the arrow keys to cycle through the accordions/carousel view thus interfering with things like textfields within those components? |
@LFDanLu I just hacked together a small demo. You can also check out Nike or Adidas to verify that those layouts are pretty common in e-commerce. The
What would be required, and what we implemented, is a way to "enter" the cell causing navigation listeners to pause on the parent container until exited. In our understanding, this is what
What i was asking @snowystinger about was handler collisions with the Unfortunately, to implement edit mode behavior, we had to roll our own |
Gotcha, thank you for the demo. Last I remember from our work on edit mode (which "paused" all the grid navigation listeners when the user pressed As for Accordion and Carousel, it looks like arrow key navigation is optional in the aria pattern for Accordion and not covered for Carousel hence my original stance that it those wouldn't need edit mode. I'm not sure if we would implement them with collection behavior like support on our end but I agree that they will need edit mode support if we did want to go down that route. I think what you've described in the "Possible Solutions" sound promising, but will have to mull it over/play around with an implementation. I assume you can move from inside the cell back to focusing the entire cell, thus restoring all the collection event handlers (aka row selection and cell navigation via arrow keys would be enabled again?) |
@LFDanLu Yes that’s exactly right 👍 Although there remain small UX issues in communicating where the focus will move when trying to enter the cell. The cell might not contain focusable content, thus landing either inside the cell or outside the collection. While we could ensure a focusable panel, it would be visually identical to the cell. We decided on the |
Talked with the team today and the consensus was that we'd be interested in supporting something like this within useSelectableCollection but we'll need to play around with it some more. Roughly we imagine the flow to be something like so:
We had a question about your implementation: how do you exit back to focusing the cell when you are inside it? I had assumed Tab handles entering/exiting the cell but someone pointed out that this would be a focus trap hence why our theoretical flow uses Shift + Tab/Escape specifically to exit back to the cell level. As for Accordion, the interactive elements that would use arrow keys/other interactions would theoretically be in the Accordion content rather than the Accordion header so thus arrow key events won't move focus through the Accordion so no need for edit mode or something like that theoretically. Carousel is still up in the air since we haven't implemented it yet |
@LFDanLu Sounds great 👍 Let us know how we can help! To answer your question, it behaves as your spec describes:
Collisions only occur because of the In regards to
A lot of e-commerce designs often represent active filters as a selectable The complexity of a dynamic filter is also why we implemented No support for adjecent elements inside the header is the tradeoff we took for it. Instead, as you mentioned, we had to accomodate the |
@nwidynski Thanks for the detailed reply! The details about your Accordion implementation as a collection component is very interesting, at the moment our own Accordion component isn't a collection component but I'm not sure we've considered the focus challenges you outlined. Just to clarify, could you expand some more on these focus scenarios? I was imagining that you ran into focus being lost when a tag was removed that the user was currently focused on but shouldn't the TagGroup handle that? Or what it that an Accordion header itself may be removed and thus focus needs to move else where inside the Accordion as a whole instead? |
@LFDanLu Yep, we dynamically remove the entire You can imagine the following scenario: Specific items may have unique facets. When a user narrows a common facet (e.g category), those items may not appear in the result set. We can subsequently auto-remove the unique facet out of the Changes to the result set can happen through user interaction but also programmatically as updates are streamed in. |
I made a small recording of it |
Hey hey, I spent some of my time updating the selectable item / collection hooks what do you think about it? #7215 |
Thanks! I'll see if I or someone on the team can take a look soon |
Provide a general summary of the feature here
We are developing a rather typical e-commerce storefront with interactive product cards, recommendation carousels and facet filtering based on a custom component library on top of react-aria hooks.
In our latest design phase our team has done extensive work on an accessible
<Carousel />
&<Accordion />
component leveraging react-aria's<Virtualizer />
and new collection package. These components were designed to become the base on top of which to build our<Filter />
,<CardCarousel />
&<CardGrid />
components, all of which represent collection components with unknown, complex, focusable content inside each item.As we retrospect, we would like to report on obstacles we faced while utilizing existing hooks and subsequently collect feedback on an extension to
useSelectableCollection()
we could see introduced into react-aria.Since we know this hook lies at the core of react-aria we decided to open this issue to discuss potential approaches to making react-aria more suitable for complex interactive collections.
For the purpose of this issue, we will mainly narrow on focus behavior and tab sequence of collection components, hoping to gain insights into the decision process and exact accessibility requirements the Spectrum team has for collections.
🤔 Expected Behavior?
While inside the cell,
tab
,shift+tab
and arrow keys can be used to navigate the cell content just like inside a<TabPanel />
, fully contained inside the cell, not propagated and storing the last visited focusable element. A click on the cell would remain to set the focused key of the outer collection.We would love to discuss the background in making collections single tab stop and the feasibility of integrating the proposal into the current state of react-aria, as we would save some bandwith by re-using existing hooks.
😯 Current Behavior
While implementing our use case, we noticed each focusable element inside a cell has to be stepped through to reach the next cell. When discovering a product grid, this presents rather bad UX in our opinion, calling for a way to skip to the next cell.
The issue is worsened by a loss of focus scope when leaving the cell, as the returning focus is placed on the first focusable element inside the cell rather than the last visited. Additionally,
arrowup
orarrowdown
interactions in nested components are not discarded in the cell navigation, causing a jump in the row instead of proper interaction.💁 Possible Solution
The likely obvious thought would be to add a new keyboard combination to jump to the next cell, but we found it to be rather infeasible as most sensible combinations are already taken up by basic cell navigation or (multi) selection of cells.
In order to solve all issues, we would like to discuss an alternative navigation mode: multi tab stop
In a similar way to the
<Tabs />
component, a cell content would pose as the tab panel. While focus is on a cell, arrow key navigation can be used to move between cells. When the desired cell is reached,tab
moves the focus inside the cell or outside the collection, depending on whether the cell contains a focusable element.🔦 Context
Out of the box, react-aria collections can operate in two tab sequences: tab navigation & single tab stop
This design works wonderfully in most scenarios, but becomes rather unhandy when dealing with cells containing a large amount of focusable elements. Real world applications of such use-cases can often be seen in modern project management apps, but also in e-commerce applications, both notoriously troubled with bad accessibility.
💻 Examples
No response
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: