@@ -34,6 +34,9 @@ export class StickyStyler {
34
34
* @param direction The directionality context of the table (ltr/rtl); affects column positioning
35
35
* by reversing left/right positions.
36
36
* @param _isBrowser Whether the table is currently being rendered on the server or the client.
37
+ * @param _needsPositionStickyOnElement Whether we need to specify position: sticky on cells
38
+ * using inline styles. If false, it is assumed that position: sticky is included in
39
+ * the component stylesheet for _stickCellCss.
37
40
*/
38
41
constructor ( private _isNativeHtmlTable : boolean ,
39
42
private _stickCellCss : string ,
@@ -183,11 +186,14 @@ export class StickyStyler {
183
186
184
187
// If the element no longer has any more sticky directions, remove sticky positioning and
185
188
// the sticky CSS class.
189
+ // Short-circuit checking element.style[dir] for stickyDirections as they
190
+ // were already removed above.
186
191
const hasDirection = STICKY_DIRECTIONS . some ( dir =>
187
- stickyDirections . indexOf ( dir ) === - 1 && ! ! element . style [ dir ] ) ;
192
+ stickyDirections . indexOf ( dir ) === - 1 && element . style [ dir ] ) ;
188
193
if ( hasDirection ) {
189
194
element . style . zIndex = this . _getCalculatedZIndex ( element ) ;
190
195
} else {
196
+ // When not hasDirection, _getCalculatedZIndex will always return ''.
191
197
element . style . zIndex = '' ;
192
198
if ( this . _needsPositionStickyOnElement ) {
193
199
element . style . position = '' ;
0 commit comments