diff --git a/src/components/Button/index.js b/src/components/Button/index.js index 4ca933a45d6f..dc12a4ded5c2 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -18,6 +18,9 @@ import PressableWithFeedback from '../Pressable/PressableWithFeedback'; import refPropTypes from '../refPropTypes'; const propTypes = { + /** Should the press event bubble across multiple instances when Enter key triggers it. */ + allowBubble: PropTypes.bool, + /** The text for the button label */ text: PropTypes.string, @@ -123,6 +126,7 @@ const propTypes = { }; const defaultProps = { + allowBubble: false, text: '', shouldShowRightIcon: false, icon: null, @@ -183,7 +187,7 @@ class Button extends Component { shortcutConfig.descriptionKey, shortcutConfig.modifiers, true, - false, + this.props.allowBubble, this.props.enterKeyEventListenerPriority, false, ); diff --git a/src/components/ButtonWithDropdownMenu.js b/src/components/ButtonWithDropdownMenu.js index 54d6c0deac5a..a0a6e276bc28 100644 --- a/src/components/ButtonWithDropdownMenu.js +++ b/src/components/ButtonWithDropdownMenu.js @@ -19,6 +19,9 @@ const propTypes = { /** Callback to execute when the main button is pressed */ onPress: PropTypes.func.isRequired, + /** Call the onPress function on main button when Enter key is pressed */ + pressOnEnter: PropTypes.bool, + /** Whether we should show a loading state for the main button */ isLoading: PropTypes.bool, @@ -57,6 +60,7 @@ const propTypes = { const defaultProps = { isLoading: false, isDisabled: false, + pressOnEnter: false, menuHeaderText: '', style: [], buttonSize: CONST.DROPDOWN_BUTTON_SIZE.MEDIUM, @@ -101,6 +105,7 @@ function ButtonWithDropdownMenu(props) {