Skip to content

Commit

Permalink
Merge pull request #1275 from Pulkitxm/select-entire-url-on-click
Browse files Browse the repository at this point in the history
Selecting the url in searchbar when clicked first
  • Loading branch information
violetadev authored Aug 6, 2024
2 parents 6affc07 + 1a71490 commit b9f5159
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const AddressBar = () => {
const [homepage, setHomepage] = useState<string>(
window.electron.store.get('homepage')
);
const [isFocused, setIsFocused] = useState(false);
const [deleteStorageLoading, setDeleteStorageLoading] =
useState<boolean>(false);
const [deleteCookiesLoading, setDeleteCookiesLoading] =
Expand Down Expand Up @@ -262,10 +263,17 @@ const AddressBar = () => {
onChange={(e) => setTypedAddress(e.target.value)}
onKeyDown={handleKeyDown}
onBlur={() => {
setIsFocused(false);
setTimeout(() => {
setIsSuggesting(false);
}, 100);
}}
onSelect={(e) => {
if (e.target === inputRef.current && !isFocused) {
inputRef.current?.select();
setIsFocused(true);
}
}}
/>
<div
className={`${
Expand Down

0 comments on commit b9f5159

Please sign in to comment.