mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 10:50:37 -06:00
TagsInput: Do not trigger submit on Enter (#48743)
* TagsInput: Do not trigger submit on Enter * Comment
This commit is contained in:
parent
3cade2f669
commit
9b8cdab123
@ -85,6 +85,13 @@ export const TagsInput: FC<Props> = ({
|
||||
onChange={onNameChange}
|
||||
value={newTagName}
|
||||
onKeyUp={onKeyboardAdd}
|
||||
onKeyDown={(e) => {
|
||||
// onKeyDown is triggered before onKeyUp, triggering submit behaviour on Enter press if this component
|
||||
// is used inside forms. Moving onKeyboardAdd callback here doesn't work since text input is not captured in onKeyDown
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
}
|
||||
}}
|
||||
onBlur={onBlur}
|
||||
invalid={invalid}
|
||||
suffix={
|
||||
|
Loading…
Reference in New Issue
Block a user