I've got a React site which uses Slate-React (https://docs.slatejs.org/libraries/slate-react) to create a rich text input field. Slate uses the browser's prompt() function to apply hyperlinks to selected text, but I need to be able to style the prompt modal so I have to find an alternative. However, if I create a simple Javascript popup with an input field, the selected text is deselected as soon as the focus is applied to the modal so no link is inserted.
Is there a way to move focus to another element whilst still keeping the original text selected?
Essentially I'm trying to emulate the Insert Hyperlink functionality/styling that Google Docs uses:

you can have this selection in state, and pass some prop using this selection to apply link on this selection. You can do this by using Transforms.select(editor, thisSelection) followed by applying link