-
Notifications
You must be signed in to change notification settings - Fork 54
feat(Accessibility): Make Grid keyboard navigable by adding Grid Behavior #398
Conversation
Codecov Report
@@ Coverage Diff @@
## master #398 +/- ##
=========================================
Coverage ? 91.79%
=========================================
Files ? 41
Lines ? 1328
Branches ? 193
=========================================
Hits ? 1219
Misses ? 105
Partials ? 4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good generally, please see comments
import { Grid, Image, Button, gridBehavior } from '@stardust-ui/react' | ||
import _ from 'lodash' | ||
|
||
const images = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this an array to save space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, sure, that does make sense. Thank you!
import { Grid, Image, Button, gridBehavior } from '@stardust-ui/react' | ||
import _ from 'lodash' | ||
|
||
const images = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this an array to save space?
I was trying this in our react conf prototype and it does not behave correctly when the grid items contain focusable items themselves: As you can see in the screenshot above, the grid items contain a button ("FULL BIO") so navigation works incorrectly: actual: arrow keys navigate to grid items then to buttons
|
@Bugaa92 You are totally right about having nested navigation. But it is not what expected in current PR. Current PR provides navigation with arrow keys on grid items itself, whether they are focusable elements or have set |
in the example I provided above, each item contains a button but also <Grid
<div className="grid item" data-is-focusable="true" >
<button>FULL BIO</button>
</div>
<div className="grid item" data-is-focusable="true" >
<button>FULL BIO</button>
</div>
...
<div className="grid item" data-is-focusable="true" >
<button>FULL BIO</button>
</div>
/> let's say the focus is in the
This looks wrong to me, do we want merge it like this? LATER EDIT: Discussed with @sophieH29 and all these complex cases will be handled in future work |
This PR adds a possibility to navigate Grid items with arrow buttons.
What was added:
accessibility
prop. (though, a default value isdefaultBehavior
)gridBehavior
withFocusZone
circular bi-directional navigationgridBehavior
for that purpose.TODO: