mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-11 02:37:21 +00:00
Only focus the URL input when no URL has been entered (#15673)
GitOrigin-RevId: e89406f5f0921898901c3c0d298e48e345a65621
This commit is contained in:
parent
b0effa7e4a
commit
1819f3e4e7
1 changed files with 7 additions and 3 deletions
|
@ -41,9 +41,13 @@ export const HrefTooltipContent: FC = () => {
|
|||
{ signal: controller.signal }
|
||||
)
|
||||
|
||||
// focus the input element if there is content selected in the doc when the tooltip opens
|
||||
if (!view.state.selection.main.empty) {
|
||||
inputRef.current.focus()
|
||||
// focus the URL input element when the tooltip opens, if the view is focused,
|
||||
// there is content selected in the doc, and no URL has been entered
|
||||
if (view.hasFocus && !view.state.selection.main.empty) {
|
||||
const currentUrl = readUrl(view.state)
|
||||
if (!currentUrl) {
|
||||
inputRef.current.focus()
|
||||
}
|
||||
}
|
||||
|
||||
inputRef.current?.addEventListener(
|
||||
|
|
Loading…
Add table
Reference in a new issue