Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added enter key functionality #3048

Merged
merged 13 commits into from
Mar 17, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `Enter` key press functionality to `EuiSuperDatePicker` ([#3048](https://github.com/elastic/eui/pull/3048))
- Exported `dateFormatAliases` as a part of the public API ([#3043](https://github.com/elastic/eui/pull/3043))
- Exported `EuiTextProps` type definition ([#3039](https://github.com/elastic/eui/pull/3039))
- Removed `role` attribute from `EuiImage`([#3036](https://github.com/elastic/eui/pull/3036))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exports[`EuiSuperDatePicker is rendered 1`] = `
<EuiFlexGroup
className="euiSuperDatePicker__flexWrapper"
gutterSize="s"
onKeyPress={[Function]}
anishagg17 marked this conversation as resolved.
Show resolved Hide resolved
responsive={false}
>
<EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export class EuiSuperDatePicker extends Component {
isCustom
startDateControl={<div />}
endDateControl={<div />}
onKeyPress={this.handleKeyPress}
readOnly>
<span className="euiSuperDatePicker__prettyFormat">
{prettyInterval(this.props.isPaused, this.props.refreshInterval)}
Expand Down Expand Up @@ -412,6 +413,12 @@ export class EuiSuperDatePicker extends Component {
}
};

handleKeyPress = event => {
if (event.key === 'Enter') {
this.handleClickUpdateButton();
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
}
};

renderUpdateButton = () => {
if (!this.props.showUpdateButton || this.props.isAutoRefreshOnly) {
return;
Expand Down Expand Up @@ -461,6 +468,7 @@ export class EuiSuperDatePicker extends Component {
<EuiFlexGroup
gutterSize="s"
responsive={false}
onKeyPress={this.handleKeyPress}
anishagg17 marked this conversation as resolved.
Show resolved Hide resolved
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
className={flexWrapperClasses}>
<EuiFlexItem>
<EuiFormControlLayout
Expand Down