aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-06 23:57:56 +0800
committerFabio Berger <me@fabioberger.com>2018-08-06 23:57:56 +0800
commit6e122691d114d042a76e1d585a11a238a1f35f47 (patch)
treeb895fd713b8939b3094793f08d56ce8c93748ee3 /packages/website/ts/components
parentea5684e0546f25fa213dfb1a780941e4056a2128 (diff)
downloaddexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar.gz
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar.bz2
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar.lz
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar.xz
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.tar.zst
dexon-sol-tools-6e122691d114d042a76e1d585a11a238a1f35f47.zip
Fix bug related to react-scroll's scrollSpy and the render order of elements
Diffstat (limited to 'packages/website/ts/components')
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index c921867d7..41b01c57b 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -1,5 +1,11 @@
import { DocsInfo, DocsMenu } from '@0xproject/react-docs';
-import { colors, MenuSubsectionsBySection, NestedSidebarMenu, Styles } from '@0xproject/react-shared';
+import {
+ colors,
+ MenuSubsectionsBySection,
+ NestedSidebarMenu,
+ Styles,
+ constants as sharedConstants,
+} from '@0xproject/react-shared';
import * as _ from 'lodash';
import Drawer from 'material-ui/Drawer';
import Menu from 'material-ui/Menu';
@@ -409,7 +415,11 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => {
return this._doesUrlInclude(websitePath);
});
- if (!isViewingDocsPage || _.isUndefined(this.props.menu)) {
+ // HACK: We need to make sure the SCROLL_CONTAINER is loaded before rendering the Sidebar
+ // because the sidebar renders `react-scroll` links which depend on the scroll container already
+ // being rendered.
+ const documentationContainer = document.getElementById(sharedConstants.SCROLL_CONTAINER_ID);
+ if (!isViewingDocsPage || _.isUndefined(this.props.menu) || _.isNull(documentationContainer)) {
return undefined;
}
return (