Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML: When a browser scrolls to an input, how can one make it bring the entire input's parent into view?
    primarykey
    data
    text
    <p>I'm not a web guy, so this might be something really simple I'm missing, but:<br> Consider the following page:<br> <a href="http://pastehtml.com/view/1bg9qno.html" rel="nofollow">http://pastehtml.com/view/1bg9qno.html</a> </p> <p>Which is basically a list of <code>&lt;input&gt;</code>s, and each input has a helper <code>&lt;span&gt;</code> with text (that will change along with the input's value on <code>keyUp</code>).</p> <p>So when the list is long enough (like in the above HTML page), if you tab thru the inputs, you will eventually get to the input on the bottom of the page, tab again, and the browser will scroll down to the next input.</p> <p>In my case, the input has the helper text which is crucial to my app.</p> <p>The problem is that when the user tabs down to the input that is not visible, the browser only brings that input into the view, and not his entire parent (<code>&lt;div class="item"&gt;</code>) which contains the helper text. As a result, this helper text is not visible to the user while he enters stuff in the input.</p> <p>How can one tell the browser to bring the entire parent into view when focusing the out-of-view input?<br> Is there any elegant solution?</p> <p>BTW: This doesn't happen in Chrome, since Chrome always scrolls down a part-page, but it always happens in <strong>Firefox</strong> which always scrolls as little as possible to the input.</p> <p>The HTML looks like this:</p> <pre><code>&lt;body&gt; &lt;div class="item"&gt; &lt;input type="text" value="text" /&gt; &lt;br /&gt; &lt;span&gt;helper text&lt;/span&gt; &lt;/div&gt; &lt;hr /&gt; ... &lt;hr /&gt; &lt;div class="item"&gt; &lt;input type="text" value="text" /&gt; &lt;br /&gt; &lt;span&gt;helper text&lt;/span&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload