@@ -140,13 +140,6 @@ const DocumentManager: React.FC = () => {
140140 }
141141 } ;
142142
143- // Function to handle browse click
144- const handleBrowseClick = ( ) => {
145- if ( fileInputRef . current ) {
146- fileInputRef . current . click ( ) ;
147- }
148- } ;
149-
150143 const handleUpload = async ( e : React . FormEvent ) => {
151144 e . preventDefault ( ) ;
152145
@@ -299,12 +292,19 @@ const DocumentManager: React.FC = () => {
299292 < div
300293 style = { {
301294 ...isDragging ? styles . fileInputWrapperActive : styles . fileInputWrapper ,
295+ position : 'relative' , // Ensure positioning context
302296 overflow : 'hidden'
303297 } }
304298 onDragOver = { handleDragOver }
305299 onDragLeave = { handleDragLeave }
306300 onDrop = { handleDrop }
307- onClick = { handleBrowseClick } // Add click handler to the entire area
301+ onClick = { ( ) => {
302+ // Explicitly trigger click on the file input
303+ const fileInput = document . getElementById ( 'fileInput' ) ;
304+ if ( fileInput ) {
305+ fileInput . click ( ) ;
306+ }
307+ } }
308308 >
309309 < div
310310 style = { {
@@ -327,12 +327,22 @@ const DocumentManager: React.FC = () => {
327327 < p style = { styles . dropText } > Drag & drop files here or < span style = { styles . browseText } > browse</ span > </ p >
328328 < input
329329 id = "fileInput"
330- ref = { fileInputRef } // Add ref to connect with handleBrowseClick
330+ ref = { fileInputRef }
331331 type = "file"
332332 accept = "application/pdf"
333333 multiple
334334 onChange = { handleFileChange }
335- style = { styles . fileInput }
335+ style = { {
336+ ...styles . fileInput ,
337+ // Make sure it's absolutely positioned but still accessible
338+ position : 'absolute' ,
339+ top : 0 ,
340+ left : 0 ,
341+ opacity : 0 ,
342+ width : '1px' ,
343+ height : '1px' ,
344+ overflow : 'hidden'
345+ } }
336346 disabled = { isUploading }
337347 />
338348 < div style = { styles . selectedFiles } >
@@ -589,8 +599,6 @@ const styles = {
589599 } ,
590600 fileInput : {
591601 marginBottom : '10px' ,
592- width : '0.1px' ,
593- height : '0.1px' ,
594602 opacity : 0 ,
595603 overflow : 'hidden' ,
596604 position : 'absolute' as const ,
0 commit comments