Skip to content

Commit

Permalink
aria updates
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmenendez committed Mar 31, 2023
1 parent a2b8a3f commit 8c96b9a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/AddSelect/List/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const List = ({
}) => {
const [focus, setFocus] = useFocus(entries.length);
return (
<div className={`${prefix}__list`}>
<div
className={`${prefix}__list`}
role="treegrid"
aria-label="add select label"
>
{entries.map((guid, index) => {
const entry = data[guid];
return (
Expand All @@ -18,6 +22,7 @@ const List = ({
setFocus={setFocus}
index={index}
focus={focus === index}
setSize={entries.length}
{...entry}
{...rest}
/>
Expand Down
14 changes: 13 additions & 1 deletion src/AddSelect/Row/Row.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const Row = ({
index,
setFocus,
parentId,
breadcrumbLevel,
setSize,
}) => {
const ref = useRef(null);

Expand Down Expand Up @@ -57,8 +59,16 @@ const Row = ({
onKeyDown={onSelectKeyDown}
tabIndex={focus ? 0 : -1}
ref={ref}
role="row"
aria-level={breadcrumbLevel}
aria-setsize={setSize}
aria-posinset={index + 1}
aria-selected={isSelected}
>
<div className={`${prefix}__input-group`}>
<div
className={`${prefix}__input-group`}
role="gridcell"
>
{isSelected ? (
<BiRadioCircleMarked size="2rem" onClick={onSelectHandler} />
) : (
Expand All @@ -71,6 +81,8 @@ const Row = ({
<button
onClick={onDrillDownHandler}
className={`${prefix}__row-button`}
tabIndex={-1}
aria-hidden
>
<BiChevronRight size="2rem" />
</button>
Expand Down
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const App = () => {
selected={selected}
setSelected={setSelected}
parentHandler={parentHandler}
breadcrumbLevel={breadcrumbs.length}
/>
<Footer
selected={selected}
Expand Down

0 comments on commit 8c96b9a

Please sign in to comment.