is there any way to keep your extension let not being closed and accessing other inputs in the website , like input? [closed]

i am working on a extension which stores some data now once i click on the website the extension is being closed i am using document.activeElement.

have done research not getting any conclusion. don’t want to close the extension.