Skip to content

Commit

Permalink
fix(docz): non latin menu headings (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejuo authored and pedronauck committed Apr 30, 2019
1 parent 9edaac8 commit 80b186c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const SmallLink: SFC<SmallLinkProps> = ({
const [isActive, setActive] = useState(false)

useEffect(() => {
const currentHash = location.hash && location.hash.slice(1, Infinity)
const decodedHash = decodeURI(location.hash)
const currentHash = decodedHash && decodedHash.slice(1, Infinity)
setActive(Boolean(slug === currentHash))
}, [location])

Expand Down
3 changes: 2 additions & 1 deletion core/docz/src/components/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export interface RoutesProps {
const goToHash = ({ location }: HistoryListenerParameter) => {
setTimeout(() => {
if (location && location.hash) {
const id: string = location.hash.substring(1)
const decodedHash = decodeURI(location.hash)
const id: string = decodedHash.substring(1)
const el: HTMLElement | null = document.getElementById(id)
if (el) el.scrollIntoView()
}
Expand Down

0 comments on commit 80b186c

Please sign in to comment.