File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,21 @@ export default () => {
9999
100100 it ( "includes inputs visible because of overflow == visible" , ( ) => {
101101 const input = document . createElement ( "input" ) ;
102- elem . style . width = "0" ;
103- elem . style . height = "0" ;
104- elem . style . overflow = "visible" ;
102+ input . style . width = "0" ;
103+ input . style . height = "0" ;
104+ input . style . overflow = "visible" ;
105105 elem . appendChild ( input ) ;
106106 tabbable ( elem ) . should . containEql ( input ) ;
107107 } ) ;
108+
109+ it ( "excludes elements with overflow == visible if there is no visible content" , ( ) => {
110+ const button = document . createElement ( "button" ) ;
111+ button . innerHTML = "You can't see me!" ;
112+ button . style . display = "none" ;
113+ button . style . overflow = "visible" ;
114+ elem . appendChild ( button ) ;
115+ tabbable ( elem ) . should . not . containEql ( button ) ;
116+ } ) ;
108117 } ) ;
109118 } ) ;
110119} ;
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ function hidesContents(element) {
2121 // Otherwise we need to check some styles
2222 const style = window . getComputedStyle ( element ) ;
2323 return zeroSize
24- ? style . getPropertyValue ( "overflow" ) !== "visible"
24+ ? style . getPropertyValue ( "overflow" ) !== "visible" ||
25+ // if 'overflow: visible' set, check if there is actually any overflow
26+ ( element . scrollWidth <= 0 && element . scrollHeight <= 0 )
2527 : style . getPropertyValue ( "display" ) == "none" ;
2628}
2729
You can’t perform that action at this time.
0 commit comments