File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,21 @@ export default () => {
99
99
100
100
it ( "includes inputs visible because of overflow == visible" , ( ) => {
101
101
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" ;
105
105
elem . appendChild ( input ) ;
106
106
tabbable ( elem ) . should . containEql ( input ) ;
107
107
} ) ;
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
+ } ) ;
108
117
} ) ;
109
118
} ) ;
110
119
} ;
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ function hidesContents(element) {
21
21
// Otherwise we need to check some styles
22
22
const style = window . getComputedStyle ( element ) ;
23
23
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 )
25
27
: style . getPropertyValue ( "display" ) == "none" ;
26
28
}
27
29
You can’t perform that action at this time.
0 commit comments