Skip to main content

Questions tagged [focus]

Focus indicates the component of the graphical user interface which is currently selected to receive input.

focus
733 votes
25 answers
413k views

Is there a way to detect if a browser window is not currently active?

I have JavaScript that is doing activity periodically. When the user is not looking at the site (i.e., the window or tab does not have focus), it'd be nice to not run. Is there a way to do this using ...
Luke Francl's user avatar
  • 31.3k
3172 votes
54 answers
831k views

How to stop EditText from gaining focus when an activity starts in Android?

I have an Activity in Android, with two elements: EditText ListView When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input ...
Mark's user avatar
  • 39.8k
1814 votes
11 answers
2.9m views

How to remove focus border (outline) around text/input boxes? (Chrome) [duplicate]

Can anyone explain how to remove the orange or blue border (outline) around text/input boxes? I think it only happens on Chrome to show that the input box is active. Here's the input CSS I'm using: ...
Joey Morani's user avatar
  • 26.2k
332 votes
7 answers
202k views

Which HTML elements can receive focus?

I'm looking for a definitive list of HTML elements which are allowed to take focus, i.e. which elements will be put into focus when focus() is called on them? I'm writing a jQuery extension which ...
Paul Turner's user avatar
  • 39.7k
334 votes
8 answers
535k views

Is it possible to focus on a <div> using JavaScript focus() function?

Is it possible to focus on a <div> using JavaScript focus() function? I have a <div> tag <div id="tries">You have 3 tries left</div> I am trying to focus on the above <...
OM The Eternity's user avatar
33 votes
6 answers
39k views

Panel not getting focus

I am continuing to program some kind of keyboard navigation in my simple graphic program (using C#). And I ran into trouble once again. My problem is that I want to process the keyboard input to move ...
Igor's user avatar
  • 1,610
82 votes
12 answers
119k views

How to make a Tkinter window jump to the front?

How do I get a Tkinter application to jump to the front? Currently, the window appears behind all my other windows and doesn't get focus. Is there some method I should be calling?
nathan's user avatar
  • 4,702
548 votes
49 answers
479k views

How to show soft-keyboard when edittext is focused

I want to automatically show the soft-keyboard when an EditText is focused (if the device does not have a physical keyboard) and I have two problems: When my Activity is displayed, my EditText is ...
Ludovic Landry's user avatar
2 votes
2 answers
12k views

How can I run code in a background thread and still access the UI?

I made a file search program in visual studio on windows 10 using .net lang, My problem starts from form1 with a "dim frm2 as form2 = new form2" call, after the new form being shown i start a while ...
orr burgel's user avatar
58 votes
6 answers
93k views

Mobile Safari Autofocus text field

In Mobile Safari I am unable to focus onto a text field after setting a delay period. I'm attaching some example code showcasing the issue. If, onclick of the button, you trigger .focus(), everything ...
boymc's user avatar
  • 1,227
431 votes
13 answers
1.1m views

How can I set focus on an element in an HTML form using JavaScript?

I have a web form with a text box in it. How do I go about setting focus to the text box by default? Something like this: <body onload='setFocusToTextBox()'> so can anybody help me with it? I ...
tenstar's user avatar
  • 10.3k
90 votes
10 answers
165k views

Mobile Safari: Javascript focus() method on inputfield only works with click?

I have a simple input field like this. <div class="search"> <input type="text" value="y u no work"/> </div>​ And I'm trying to focus() it inside a function. So inside of a ...
matt's user avatar
  • 43.8k
4 votes
3 answers
5k views

Selenium switch focus to tab, which opened after clicking link

For automation purposes, I am working on creating a script that finds a row in a table. This row is clickable and opens a new tab/adress. With selenium, I am now able to find the table row, click on ...
Jelleko's user avatar
  • 53
433 votes
18 answers
467k views

Android: Force EditText to remove focus? [duplicate]

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How ...
Alex1987's user avatar
  • 9,457
251 votes
35 answers
211k views

In React ES6, why does the input field lose focus after typing a character?

In my component below, the input field loses focus after typing a character. While using Chrome's Inspector, it looks like the whole form is being re-rendered instead of just the value attribute of ...
spunge's user avatar
  • 3,027

15 30 50 per page
1
2 3 4 5
64