Skip to content

Commit

Permalink
[REVERT ME] Added a custom keydown event that overrides our Enter map…
Browse files Browse the repository at this point in the history
…ping as an example
  • Loading branch information
breehall committed Apr 28, 2023
1 parent 1d6c644 commit 2460856
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src-docs/src/views/inline_edit/inline_edit_text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, KeyboardEvent } from 'react';

import {
EuiInlineEditText,
Expand Down Expand Up @@ -31,6 +31,14 @@ export default () => {
setToggleTextButtonSize(optionId);
};

const customKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Enter') {
alert('Hey this is a custom keydown message!');
} else {
return;
}
};

return (
<>
<EuiButtonGroup
Expand All @@ -48,6 +56,11 @@ export default () => {
inputAriaLabel="Edit text inline"
defaultValue="Hello World!"
size={toggleTextButtonSize}
editModeProps={{
inputProps: {
onKeyDown: customKeyDown,
},
}}
/>
</>
);
Expand Down

0 comments on commit 2460856

Please sign in to comment.