Closed catherinecarter closed 1 year ago
Made some progress here, but the slider functionality for the cards needs work. It will navigate to cards, but we need to figure out which property is going to be best to move the cards along. It could be the cellPositionProperty, but we'll need a way to adjust the enabledRangeProperty as the list of cards grows. We'll also need a way to track it's old value... I'm wondering if some of this could be done through a link to the cellPositionProperty, but I ran out of time to really investigate things.
Here's a patch that will hopefully help a bit.
Patch with ideas and TODOs:
I am concerned that we should check in with @catherinecarter and probably @emily-phet about the intended design here before going much further. When manipulating the cards with the keyboard, should there be animation? If so, should the focused card animate, or just the displaced cards when it moves? Should the moved card be "offset" like when dragging? Should the user have to press spacebar to pick up a card? Should there be any continuous motion, or should it all be discrete (pressing arrow moves a card a full cell)? Should the behavior be any different with shift or pageup/down?
Attaching to related issue https://github.com/phetsims/scenery/issues/1238
I mentioned in slack to @jessegreenberg:
It would be nice to develop drag listeners for mouse/touch have them naturally (or with a minimal adapter) work for keyboard.
I'm not sure if we have anything like that at the moment, or if we should investigate.
@emily-phet said:
Hmm, I had thought that Taliesin had been consulted earlier in the design process re some of the more interesting interactions in this sim. Perhaps that did not happen? Looking into it, the interaction with the cards, and possibly the soccer balls, should probably follow this pattern: https://salesforce-ux.github.io/dnd-a11y-patterns/#/sortB?_k=pdhjs7. That would require some changes. For the case of the cards: tabbing to them would tab to the cards as a whole group. The whole group would then get a thick pink outline, with initial focus (think outline) on the first card. Arrow keys navigate to different cards. When the card group is tabbed to, a visual should appear indicating the user can press spacebar to grab a card (we have examples of this kind of thing in BASE, Faraday’s Law, Friction, and probably others. When spacebar is pressed, the selected cards is animated as raised up, and then as arrow key is pressed this card animates to new position. Spacebar drops it in place (you’d hear associated sounds as well). Keyboard help dialog would need to have a section on this.
Note - listbox has been used within PhET sims, but only as part of combobox, I believe. Not on its own.
Reasons to take this approach over the current “tab to each one and arrow key moves left/right”:
Taliesin will be back from vacation tomorrow, I think, and it would be good to check that she agrees with my interpretation of things.
@catherinecarter said:
Thanks, Emily! Your response will help frame the thinking on this one. Yes, I met with Taliesin a few months ago (https://github.com/phetsims/center-and-variability/issues/162) but I don’t think we discussed the details of the cards, just that they needed to be included. Our conversation focused mainly on the soccer balls, so I’ll reach out to her tomorrow and pick the conversation up again to include a more detailed discussion of the cards. @samreid, perhaps we can include @terracoda in our meeting, I think her input would be valuable. Or, I can meet with Taliesin and report back, whichever is a better use of your time.
Meeting scheduled for Friday, I'll unassign and put this issue on-hold until then.
Looking forward to connecting and discussing these interactions more deeply.
See also https://github.com/phetsims/geometric-optics/issues/258 for discussion about whether to use a "grab" 2-step interaction to pick up an object. We noticed many sims have a 2-step spacebar grab, but geometric optics does not.
@samreid re 2-step interaction - yes, the optimal in the vast majority of cases for custom objects is a 2-step interaction. Note - we have a specific way of defining a "custom interaction", which might be helpful to talk through with all the devs involved, if you're not familiar. In sims where a more comprehensive inclusive feature set is not on the horizon, and at the preference of the design teams, a different approach has been taken at times.
Regardless - the cases of this that I'm aware of are not a "sorting" variation of a grab-and-drag interactions, which is the case for the cards in CaV and possibly the soccer balls. So sorting has additional considerations.
My meeting notes from today, please correct or elaborate:
https://www.w3.org/WAI/ARIA/apg/patterns/listbox/ https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-rearrangeable/
Tab to the group Use arrow keys to select an item in group Spacebar/enter to select an item. Arrow keys to move the item. Spacebar/enter drops the item and the group gets focus again Or escape key unselects it.
For the soccer balls, maybe show a dotted line vs solid line when grabbed? Focus single balls within the group instead of a column of soccer balls.
Unanswered questions: Do we need card animation when a card moves?
CC adding:
I think setting up a time with @jessegreenberg to talk through how we would implement this would be incredibly helpful. Will confirm we are moving forward with this implementation before setting up that meeting.
Assigning @catherinecarter to confirm interactions and labeling as high priority as we need to move on this sooner rather than later.
Decisions:
Still to do:
Here is a patch with a KeyboardListener and some thoughts to get us started:
We didn’t discuss the exact housing structure for the stacks of soccer balls at the meeting.
I think it makes sense to have them be a list structure with each stack as a list item with a “grab top ball” button.
The list structure (if it works) will provide an automatic group summary of the number of items (stacks) and possibly provide automatic updated counts of items (stacks) as a ball is moved to new places on the field.
This an educated guess and might make the structure of the soccer ball data more connected to the structure of the cards which definitely be a sortable list.
What I am unsure about is whether each meter mark is a list item and the ones with no balls are empty items.
Here is a patch from some progress today:
I added a rough draft commit for CardNodeContainer, with numerous TODOs for next steps.
We confirmed the design considerations with @catherinecarter previously. We also checked in with @matthew-blackman and caught some other bugs (like the need to uncheck the sort data checkbox). All work here was done in collaboration, and seems in good shape. Closing.
Currently on the Median screen, the tabs skip over the cards in the Accordion box. When tabbing into the accordion box, the cards will each get their own tab so the user can move each card if they wish.