-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17708 from azimgd/keycommand-v3
Allow keyboard shortcuts to work on native devices
- Loading branch information
Showing
22 changed files
with
373 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const registerKeyCommands = () => {}; | ||
const unregisterKeyCommands = () => {}; | ||
const constants = {}; | ||
const eventEmitter = () => {}; | ||
const addListener = () => {}; | ||
|
||
export { | ||
registerKeyCommands, | ||
unregisterKeyCommands, | ||
constants, | ||
eventEmitter, | ||
addListener, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Validate if the submit shortcut should be triggered depending on the button state | ||
* | ||
* @param {boolean} isFocused Whether Button is on active screen | ||
* @param {boolean} isDisabled Indicates whether the button should be disabled | ||
* @param {boolean} isLoading Indicates whether the button should be disabled and in the loading state | ||
* @param {Object} event Focused input event | ||
* @returns {boolean} Returns `true` if the shortcut should be triggered | ||
*/ | ||
function validateSubmitShortcut(isFocused, isDisabled, isLoading, event) { | ||
if (!isFocused || isDisabled || isLoading || (event && event.target.nodeName === 'TEXTAREA')) { | ||
return false; | ||
} | ||
|
||
event.preventDefault(); | ||
return true; | ||
} | ||
|
||
export default validateSubmitShortcut; |
Oops, something went wrong.