@@ -589,8 +589,7 @@ function App() {
589589 setEditingEventId ( null )
590590 }
591591
592- const onSaveEvent = async ( event : FormEvent ) => {
593- event . preventDefault ( )
592+ const saveEvent = async ( ) => {
594593 setEventsLoading ( true )
595594
596595 try {
@@ -632,15 +631,6 @@ function App() {
632631 }
633632 }
634633
635- const onEventComposerKeyDown = ( event : React . KeyboardEvent < HTMLFormElement > ) => {
636- if ( event . key !== 'Enter' ) return
637-
638- const target = event . target as HTMLElement
639- if ( target . tagName === 'TEXTAREA' ) return
640-
641- event . preventDefault ( )
642- }
643-
644634 const onEditEvent = ( selected : EventPayload ) => {
645635 setEditingEventId ( selected . id )
646636 setEventForm ( {
@@ -786,7 +776,7 @@ function App() {
786776 </ div >
787777
788778 { isAuthenticated && (
789- < form className = "auth-form event-form" onSubmit = { onSaveEvent } onKeyDown = { onEventComposerKeyDown } >
779+ < section className = "auth-form event-form" aria-label = "Event composer" >
790780 < div className = "event-form-grid" >
791781 < label >
792782 Title
@@ -878,7 +868,7 @@ function App() {
878868 </ div >
879869
880870 < div className = "action-row" >
881- < button className = "cta" type = "submit" disabled = { eventsLoading } >
871+ < button className = "cta" type = "button" onClick = { ( ) => void saveEvent ( ) } disabled = { eventsLoading } >
882872 { eventsLoading ? 'Saving...' : editingEventId ? 'Update event' : 'Create event' }
883873 </ button >
884874 < button type = "button" onClick = { resetEventComposer } disabled = { eventsLoading } >
@@ -894,7 +884,7 @@ function App() {
894884 Reload list
895885 </ button >
896886 </ div >
897- </ form >
887+ </ section >
898888 ) }
899889
900890 < div className = "events-list" >
0 commit comments