Skip to content

Commit

Permalink
Install the page.clickHandler on the root layout element
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Oct 31, 2018
1 parent 3758dbb commit 669efdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class Layout extends Component {
colorSchemePreference: PropTypes.string,
};

pageHandler = e => {
page.onclick( e.nativeEvent );
};
// Intercepts <a href> clicks in the document and passes them to the `page` router to handle.
// If the link is internal to Calypso, the router will handle the navigation with `pushState`
// instead of letting the browser reload the whole app by performing a classic navigation.
pageClickHandler = e => page.clickHandler( e.nativeEvent );

render() {
const sectionClass = classnames(
Expand All @@ -83,7 +84,8 @@ class Layout extends Component {
} );

return (
<div className={ sectionClass } onClick={ this.pageHandler }>
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
<div className={ sectionClass } onClick={ this.pageClickHandler }>
<DocumentHead />
<QuerySites primaryAndRecent />
<QuerySites allSites />
Expand Down

0 comments on commit 669efdd

Please sign in to comment.