css - How to prevent hidden element to be shown when focused in Chrome? -


i have strange problem today, in chrome, when focus on element absolutely positioned out of overflow hidden container, gets visible in chrome browser (mac).

i've made fiddle illustrate problem : http://jsfiddle.net/ghgtc/

html

    <div id="container">         <a id="inner-button" href="#">you can see me !</a>     </div> 

css

#container{     display: block;     background: blue;     width: 200px;     height: 30px;     position: relative;     overflow: hidden; }  #inner-button{     display: block;     background: red;     width: 20px;     height: 20px;     position: absolute;     top: 5px;     right: -20px; } 

thanks !

cheers !

use tabindex="-1" on "inner-button". prevent focus. http://jsfiddle.net/ghgtc/2/

<input placeholder="focus on me press tab" type="text"> <div id="container">     <a id="inner-button" tabindex="-1" href="#">you can see me !</a> </div> 

update:

i realized there possible solution issue while working on focus issue of own. can use z-index:-1 if focus need triggered later via javascript event.

#inner-button{     display: block;     background: red;     width: 20px;     height: 20px;     position: absolute;     top: 5px;     right: -20px;     z-index:-1; } 

http://jsfiddle.net/ghgtc/3/

that keep focusable hidden. , can make visible z-index:0 dynamically.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -