Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #341 from metasfresh/dev-215
Browse files Browse the repository at this point in the history
fix #215 - preventing default action when having conflicting shortcut
  • Loading branch information
damianprzygodzki authored Feb 17, 2017
2 parents 28fb765 + 0fb705c commit 640d601
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/shortcuts/DocumentStatusContextShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import React, { Component } from 'react';
import { Shortcuts } from 'react-shortcuts';

class DocumentStatusContextShortcuts extends Component {
handleShortcuts = (action) => {
handleShortcuts = (action, event) => {
const {
handleDocumentCompleteStatus
} = this.props;

switch (action) {
case 'COMPLETE_STATUS':
event.preventDefault();
return handleDocumentCompleteStatus();
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/shortcuts/PaginationContextShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ class PaginationContextShortcuts extends Component {
super(props);
}

handleShortcuts = (action) => {
handleShortcuts = (action, event) => {
const {
handleFirstPage, handleLastPage, handlePrevPage, handleNextPage
} = this.props;

switch (action) {
case 'FIRST_PAGE':
event.preventDefault();
return handleFirstPage();
case 'LAST_PAGE':
event.preventDefault();
return handleLastPage();
case 'NEXT_PAGE':
event.preventDefault();
return handleNextPage();
case 'PREV_PAGE':
event.preventDefault();
return handlePrevPage();
}
}
Expand Down

0 comments on commit 640d601

Please sign in to comment.