mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
Workaround for editor updating file when not focused in Safari (#23023)
GitOrigin-RevId: da9341b2cadf4b073eb4062619a9fa7bcba17c6b
This commit is contained in:
committed by
Copybot
parent
21e24b1ec3
commit
00a10dcbf6
@@ -103,6 +103,18 @@ export default function FileViewHeader({ file }: FileViewHeaderProps) {
|
||||
{refreshError && (
|
||||
<FileViewRefreshError file={file} refreshError={refreshError} />
|
||||
)}
|
||||
|
||||
{/* Workaround for Safari issue: https://github.com/overleaf/internal/issues/21363
|
||||
* The editor behind a file view receives key events and updates the file even if Codemirror view is not focused.
|
||||
* Changing the focus to a hidden textarea prevents this
|
||||
*/}
|
||||
<textarea
|
||||
// eslint-disable-next-line jsx-a11y/no-autofocus
|
||||
autoFocus
|
||||
aria-hidden="true"
|
||||
tabIndex={-1}
|
||||
style={{ position: 'absolute', left: '-9999px' }}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user