Skip to content

Commit

Permalink
fix: using aria label
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmch committed Nov 7, 2023
1 parent 96dcdbe commit e68d12d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
10 changes: 4 additions & 6 deletions src/components/Toc/Toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react';

import block from 'bem-cn-lite';
import {omit} from 'lodash';
import {WithTranslation} from 'react-i18next';

import {withTranslation} from '../../hoc/withTranslation';
import {PopperPosition} from '../../hooks';
import {ControlSizes, Router, TocData, TocItem} from '../../models';
import {isActiveItem, normalizeHash, normalizePath} from '../../utils';
Expand All @@ -23,7 +21,7 @@ function zip<T>(array: string[], fill: T): Record<string, T> {
return array.reduce((acc, item) => Object.assign(acc, {[item]: fill}), {});
}

export interface TocProps extends TocData, WithTranslation {
export interface TocProps extends TocData {
router: Router;
headerHeight?: number;
tocTitleIcon?: React.ReactNode;
Expand Down Expand Up @@ -155,7 +153,7 @@ class Toc extends React.Component<TocProps, TocState> {

private renderList = (items: TocItem[]) => {
const {toggleItem} = this;
const {singlePage, t} = this.props;
const {singlePage, title} = this.props;
const {activeId, fixedById} = this.state;

const activeItem = activeId && this.state.registry.getItemById(activeId);
Expand All @@ -164,7 +162,7 @@ class Toc extends React.Component<TocProps, TocState> {
: {};

return (
<ul className={b('list')} aria-label={t('description')}>
<ul className={b('list')} aria-label={title}>
{items.map((item, index) => {
const main = !this.state.registry.getParentId(item.id);
const active =
Expand Down Expand Up @@ -338,4 +336,4 @@ class Toc extends React.Component<TocProps, TocState> {
};
}

export default withTranslation('toc')(Toc);
export default Toc;
9 changes: 0 additions & 9 deletions src/hoc/withTranslation.ts

This file was deleted.

0 comments on commit e68d12d

Please sign in to comment.