Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Fix scrolling of long modal dialogs
Browse files Browse the repository at this point in the history
NOTE: react-modal removed the ability to select where the modal div is inserted into in version 1.3.0. This is because aria-hidden (i.e. "ignore this" for screenreaders) is added to the rest of the app, but now that the modal is also included in the app, it gets hidden from screenreaders as well. There's currently a PR open (reactjs/react-modal#183) that tries to address this, so we might see the return of this feature at some point. We should upgrade then.
  • Loading branch information
vsaarinen committed Sep 15, 2016
1 parent 6e6a3f0 commit 4d89919
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"react-dom": "^15.3.1",
"react-fontawesome": "^1.2.0",
"react-gravatar": "^2.4.5",
"react-modal": "^1.4.0",
"react-modal": "^1.2.1",
"react-redux": "^4.4.5",
"react-router": "^2.8.1",
"react-router-redux": "^4.0.5",
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class App extends React.Component<PassedProps & GeneratedDispatchProps, any> {
const { children } = this.props;

return (
<div className={classNames(styles.app)}>
<div id="minard-app" className={classNames(styles.app)}>
<Header />
<SubHeader />
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/common/forms/modal-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
}

.overlay {
position: fixed;
overflow-y: auto;
position: absolute;
z-index: 99;
top: 0;
left: 0;
width: 100%;
Expand Down
6 changes: 6 additions & 0 deletions src/js/components/project-view/project-settings-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class ProjectSettingsDialog extends React.Component<Props, any> {
this.clearAndClose = this.clearAndClose.bind(this);
}

public componentWillMount() {
// We need to mount the modal onto our App component so that
// the overlay covers the whole app
(ModalDialog as any).setAppElement('#minard-app');
}

private deleteProject() {
const { project, deleteProject, router } = this.props;

Expand Down
6 changes: 6 additions & 0 deletions src/js/components/team-projects-view/new-project-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ class NewProjectDialog extends React.Component<Props, any> {
this.onSuccessfulCreation = this.onSuccessfulCreation.bind(this);
}

public componentWillMount() {
// We need to mount the modal onto our App component so that
// the overlay covers the whole app
(ModalDialog as any).setAppElement('#minard-app');
}

private onSuccessfulCreation(projectId: string) {
this.props.closeDialog();
this.props.router.push(`/project/${projectId}`);
Expand Down

0 comments on commit 4d89919

Please sign in to comment.