File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
DataEntry/DataEntryTable/NewEntry Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ interface NoteButtonProps {
1919export default function NoteButton ( props : NoteButtonProps ) : ReactElement {
2020 const [ noteOpen , setNoteOpen ] = useState < boolean > ( false ) ;
2121
22+ const handleOpen = ( ) : void => {
23+ setNoteOpen ( true ) ;
24+ // Blur the button to prevent it from receiving focus when dialog closes
25+ if ( document . activeElement instanceof HTMLElement ) {
26+ document . activeElement . blur ( ) ;
27+ }
28+ } ;
29+
2230 return (
2331 < >
2432 < IconButtonWithTooltip
@@ -36,7 +44,7 @@ export default function NoteButton(props: NoteButtonProps): ReactElement {
3644 />
3745 )
3846 }
39- onClick = { props . updateNote ? ( ) => setNoteOpen ( true ) : undefined }
47+ onClick = { props . updateNote ? handleOpen : undefined }
4048 side = "top"
4149 size = "small"
4250 text = { props . noteText || undefined }
Original file line number Diff line number Diff line change @@ -36,9 +36,6 @@ export enum FocusTarget {
3636 Vernacular ,
3737}
3838
39- /** Delay in ms to ensure focus change happens after browser focus management completes */
40- const FOCUS_DELAY_MS = 10 ;
41-
4239interface NewEntryProps {
4340 analysisLang : WritingSystem ;
4441 vernacularLang : WritingSystem ;
@@ -280,9 +277,7 @@ export default function NewEntry(props: NewEntryProps): ReactElement {
280277 < NoteButton
281278 buttonId = { NewEntryId . ButtonNote }
282279 noteText = { submitting ? "" : newNote }
283- onExited = { ( ) =>
284- setTimeout ( ( ) => focus ( FocusTarget . Gloss ) , FOCUS_DELAY_MS )
285- }
280+ onExited = { ( ) => focus ( FocusTarget . Gloss ) }
286281 updateNote = { setNewNote }
287282 />
288283 ) }
You can’t perform that action at this time.
0 commit comments