Skip to content

Commit

Permalink
aria selected should work on load
Browse files Browse the repository at this point in the history
  • Loading branch information
seungpark committed Dec 26, 2024
1 parent 03971bb commit f0c5498
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/MethodSelector/MethodSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const MethodSelector = ({ nodeData: { children } }) => {
className={cx(radioBoxStyle)}
value={`${id}-${index}`}
checked={selectedMethod === id}
aria-selected={isOfflineDocsBuild ? index === 0 : null}
aria-selected={isOfflineDocsBuild ? selectedMethod === id : null}
>
{title}
</RadioBox>
Expand Down
5 changes: 4 additions & 1 deletion src/utils/head-scripts/offline-ui/method-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function bindMethodSelectorUI() {
const labels = methodSelectorComponent.querySelectorAll('label');

// for each input, find value `{name}-{index}` ie. `driver-0`
// find data-testid=[method-option-content-{name}] and show
// find content div with data-testid=[method-option-content-{name}] and show that content div
for (let idx = 0; idx < buttons.length; idx++) {
const button = buttons[idx];
button.addEventListener('click', (e) => {
Expand All @@ -33,6 +33,9 @@ function bindMethodSelectorUI() {
}
});
}

// on load, set first label as active
labels[0]?.setAttribute('aria-selected', true);
}
} catch (e) {
console.error(e);
Expand Down

0 comments on commit f0c5498

Please sign in to comment.