Skip to content

Commit

Permalink
Merge pull request #1294 from sarahd93/dialog_gsa8
Browse files Browse the repository at this point in the history
Fix dialog can be moved outside browser frame
  • Loading branch information
bjoernricks authored Apr 18, 2019
2 parents 36e2b5f + b05a799 commit a5b2e95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Cleanup get_report function in gsad [#1263](https://github.com/greenbone/gsa/pull/1263)

### Fixed
- Fix dialog can be moved outside browser frame [#1294](https://github.com/greenbone/gsa/pull/1294)
- Fix permission description [#1292](https://github.com/greenbone/gsa/pull/1292)
- Fix port ranges from file radio button [#1291](https://github.com/greenbone/gsa/pull/1291)
- Don't run more then one reload timer for a page [#1289](https://github.com/greenbone/gsa/pull/1289)
Expand Down
8 changes: 7 additions & 1 deletion gsa/src/web/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ class Dialog extends React.Component {
const left = event.pageX - this.relX;
const top = event.pageY - this.relY;

this.setDialogPosition(left, top);
const rightBorder = window.outerWidth - DEFAULT_DIALOG_MIN_WIDTH;
const bottomBorder = window.outerHeight - DEFAULT_DIALOG_MIN_HEIGHT;

this.setDialogPosition(
Math.min(Math.max(left, 0), rightBorder),
Math.min(Math.max(top, 0), bottomBorder),
);

event.preventDefault();
}
Expand Down

0 comments on commit a5b2e95

Please sign in to comment.