How do I stop websites from stealing the focus of my text input?

48 views
Skip to first unread message

Kyza

unread,
May 5, 2018, 11:31:17 AM5/5/18
to Chromium-Extensions-Announce
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

PhistucK

unread,
May 5, 2018, 11:42:26 AM5/5/18
to The Kreepy Gamer, Chromium-extensions
Maybe try calling preventDefault() on the blur or focusout event?
(I guess they listen to keydown and then steal the focus, so in order not to annoy or lock the user, check whether keydown was not for pressing Tab first and then preventDefault() the blur/focusout event)

PhistucK


On Sat, May 5, 2018 at 6:31 PM Kyza <tyler...@gmail.com> wrote:
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/10f4d188-2407-42d9-84a7-0fa6910bfcd1%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Kyza

unread,
May 5, 2018, 12:04:43 PM5/5/18
to Chromium-Extensions-Announce, tyler...@gmail.com
I have tried the following in both the blur and focus out events.

event.preventDefault();
event.stopPropagation();
return false;

None of the above seem to work, the focus only returns if I call .focus() on the input. There are 2 problems with that:
  1. I have the text input highlight itself on focus for ease of use, so every character it refocuses and deletes what was in it.
  2. It is incredibly slow. And I am on a moderately fast computer as well.

On Saturday, May 5, 2018 at 11:42:26 AM UTC-4, PhistucK wrote:
Maybe try calling preventDefault() on the blur or focusout event?
(I guess they listen to keydown and then steal the focus, so in order not to annoy or lock the user, check whether keydown was not for pressing Tab first and then preventDefault() the blur/focusout event)

PhistucK


On Sat, May 5, 2018 at 6:31 PM Kyza <tyler...@gmail.com> wrote:
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.

Kyza

unread,
May 5, 2018, 1:47:12 PM5/5/18
to Chromium-Extensions-Announce, tyler...@gmail.com
"None of the above seem to work"

How does that justify this as complete?

PhistucK

unread,
May 5, 2018, 1:50:12 PM5/5/18
to The Kreepy Gamer, Chromium-extensions
Do not mind this "mark as complete" or "marked complete"... I guess anyone can click on it.

PhistucK


On Sat, May 5, 2018 at 8:47 PM Kyza <tyler...@gmail.com> wrote:
"None of the above seem to work"

How does that justify this as complete?

On Saturday, May 5, 2018 at 12:04:43 PM UTC-4, Kyza wrote:
I have tried the following in both the blur and focus out events.

event.preventDefault();
event.stopPropagation();
return false;

None of the above seem to work, the focus only returns if I call .focus() on the input. There are 2 problems with that:
  1. I have the text input highlight itself on focus for ease of use, so every character it refocuses and deletes what was in it.
  2. It is incredibly slow. And I am on a moderately fast computer as well.

On Saturday, May 5, 2018 at 11:42:26 AM UTC-4, PhistucK wrote:
Maybe try calling preventDefault() on the blur or focusout event?
(I guess they listen to keydown and then steal the focus, so in order not to annoy or lock the user, check whether keydown was not for pressing Tab first and then preventDefault() the blur/focusout event)

PhistucK


On Sat, May 5, 2018 at 6:31 PM Kyza <tyler...@gmail.com> wrote:
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.

Kyza

unread,
May 5, 2018, 2:28:46 PM5/5/18
to Chromium-Extensions-Announce, tyler...@gmail.com
At this rate, I'll never get an answer--let alone a suggestion--since everyone passes this by because they think it is actually complete.


On Saturday, May 5, 2018 at 1:50:12 PM UTC-4, PhistucK wrote:
Do not mind this "mark as complete" or "marked complete"... I guess anyone can click on it.

PhistucK


On Sat, May 5, 2018 at 8:47 PM Kyza <tyler...@gmail.com> wrote:
"None of the above seem to work"

How does that justify this as complete?

On Saturday, May 5, 2018 at 12:04:43 PM UTC-4, Kyza wrote:
I have tried the following in both the blur and focus out events.

event.preventDefault();
event.stopPropagation();
return false;

None of the above seem to work, the focus only returns if I call .focus() on the input. There are 2 problems with that:
  1. I have the text input highlight itself on focus for ease of use, so every character it refocuses and deletes what was in it.
  2. It is incredibly slow. And I am on a moderately fast computer as well.

On Saturday, May 5, 2018 at 11:42:26 AM UTC-4, PhistucK wrote:
Maybe try calling preventDefault() on the blur or focusout event?
(I guess they listen to keydown and then steal the focus, so in order not to annoy or lock the user, check whether keydown was not for pressing Tab first and then preventDefault() the blur/focusout event)

PhistucK


On Sat, May 5, 2018 at 6:31 PM Kyza <tyler...@gmail.com> wrote:
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.

PhistucK

unread,
May 5, 2018, 3:33:32 PM5/5/18
to The Kreepy Gamer, Chromium-extensions
I think most people here subscribe to the group via e-mail, so they do not see this indication anyway.

Though I do suggest stackoverflow.com for a few reasons -
1. Larger audience (and a point system).
2. It is the official place for Chrome extension development support.
3. Your question is probably not relevant only to extensions (what if some library took the focus when you typed on your own website and you wanted to work around that?).

PhistucK


On Sat, May 5, 2018 at 9:28 PM Kyza <tyler...@gmail.com> wrote:
At this rate, I'll never get an answer--let alone a suggestion--since everyone passes this by because they think it is actually complete.

On Saturday, May 5, 2018 at 1:50:12 PM UTC-4, PhistucK wrote:
Do not mind this "mark as complete" or "marked complete"... I guess anyone can click on it.

PhistucK


On Sat, May 5, 2018 at 8:47 PM Kyza <tyler...@gmail.com> wrote:
"None of the above seem to work"

How does that justify this as complete?

On Saturday, May 5, 2018 at 12:04:43 PM UTC-4, Kyza wrote:
I have tried the following in both the blur and focus out events.

event.preventDefault();
event.stopPropagation();
return false;

None of the above seem to work, the focus only returns if I call .focus() on the input. There are 2 problems with that:
  1. I have the text input highlight itself on focus for ease of use, so every character it refocuses and deletes what was in it.
  2. It is incredibly slow. And I am on a moderately fast computer as well.

On Saturday, May 5, 2018 at 11:42:26 AM UTC-4, PhistucK wrote:
Maybe try calling preventDefault() on the blur or focusout event?
(I guess they listen to keydown and then steal the focus, so in order not to annoy or lock the user, check whether keydown was not for pressing Tab first and then preventDefault() the blur/focusout event)

PhistucK


On Sat, May 5, 2018 at 6:31 PM Kyza <tyler...@gmail.com> wrote:
I am making a sort of overlay which has a text input, but certain websites--like this one and Bing's homepage--steal the focus of the text input as soon as I start typing in it. I tried resetting the focus when it is changed, but the text still types into whatever is stealing the focus.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
Reply all
Reply to author
Forward
0 new messages