Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/core/button/segmented-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';

const SegmentedControl = ({ items, value, onChange, 'aria-label': ariaLabel, buttonClassName }) => {
const SegmentedControl = ({
items,
value,
onChange,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
buttonClassName,
}) => {
return (
<ul
aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
className="flex items-stretch rounded-lg border border-border-main overflow-hidden"
>
{items.map((item) => {
Expand Down Expand Up @@ -49,6 +57,7 @@ SegmentedControl.propTypes = {
value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
'aria-label': PropTypes.string,
'aria-labelledby': PropTypes.string,
buttonClassName: PropTypes.string,
};

Expand Down
6 changes: 5 additions & 1 deletion src/pages/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,14 @@ export default function Home() {
<h2>{t('editContent')}</h2>
<div className="flex items-center gap-2">
<div className="flex items-center">
<div className="mr-2 text-text-primary text-sm font-medium">
<div
id="latex-delimiter-label"
className="mr-2 text-text-primary text-sm font-medium"
>
{t('latexDelimiter.name')}
</div>
<SegmentedControl
aria-labelledby="latex-delimiter-label"
items={latexDelimiterOptions}
value={displayConfig.latexDelimiter}
onChange={(option) => setDisplayConfig({ latexDelimiter: option })}
Expand Down
Loading