Skip to content

Commit

Permalink
feat: allow scroll spy item href to start not with #
Browse files Browse the repository at this point in the history
  • Loading branch information
yndx-birman authored and 3y3 committed Oct 12, 2023
1 parent ee0b1dc commit b6ad6ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Scrollspy/Scrollspy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class Scrollspy extends React.Component<ScrollspyInnerProps, ScrollspySta
private initItems() {
const {items} = this.props;
const targetItems = items
.map((item) => document.getElementById(item.slice(1)))
.map((item) => document.getElementById(item.split('#')[1]))
.filter(Boolean) as HTMLElement[];

this.setState({targetItems}, this.initSections);
Expand Down

0 comments on commit b6ad6ff

Please sign in to comment.