Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit c252aba

Browse files
fix(top-app-bar): Remove applyPassive function from toolbar/top app bar (#2487)
The basic `scroll` event cannot be canceled, so `{passive: true}` has no effect.
1 parent 3f23821 commit c252aba

File tree

5 files changed

+4
-122
lines changed

5 files changed

+4
-122
lines changed

packages/mdc-toolbar/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ import {MDCComponent} from '@material/base/index';
1818
import {MDCRipple} from '@material/ripple/index';
1919

2020
import MDCToolbarFoundation from './foundation';
21-
import * as util from './util';
2221

2322
export {MDCToolbarFoundation};
24-
export {util};
2523

2624
export class MDCToolbar extends MDCComponent {
2725
static attachTo(root) {
@@ -66,8 +64,8 @@ export class MDCToolbar extends MDCComponent {
6664
hasClass: (className) => this.root_.classList.contains(className),
6765
addClass: (className) => this.root_.classList.add(className),
6866
removeClass: (className) => this.root_.classList.remove(className),
69-
registerScrollHandler: (handler) => window.addEventListener('scroll', handler, util.applyPassive()),
70-
deregisterScrollHandler: (handler) => window.removeEventListener('scroll', handler, util.applyPassive()),
67+
registerScrollHandler: (handler) => window.addEventListener('scroll', handler),
68+
deregisterScrollHandler: (handler) => window.removeEventListener('scroll', handler),
7169
registerResizeHandler: (handler) => window.addEventListener('resize', handler),
7270
deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler),
7371
getViewportWidth: () => window.innerWidth,

packages/mdc-toolbar/util.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/mdc-top-app-bar/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import MDCTopAppBarFoundation from './foundation';
2020
import MDCComponent from '@material/base/component';
2121
import {MDCRipple} from '@material/ripple/index';
2222
import {cssClasses, strings} from './constants';
23-
import * as util from './util';
2423
import MDCShortTopAppBarFoundation from './short/foundation';
2524

2625
/**
@@ -89,7 +88,7 @@ class MDCTopAppBar extends MDCComponent {
8988
notifyNavigationIconClicked: () => {
9089
this.emit(strings.NAVIGATION_EVENT, {});
9190
},
92-
registerScrollHandler: (handler) => window.addEventListener('scroll', handler, util.applyPassive()),
91+
registerScrollHandler: (handler) => window.addEventListener('scroll', handler),
9392
deregisterScrollHandler: (handler) => window.removeEventListener('scroll', handler),
9493
getViewportScrollY: () => window.pageYOffset,
9594
getTotalActionItems: () =>
@@ -108,4 +107,4 @@ class MDCTopAppBar extends MDCComponent {
108107
}
109108
}
110109

111-
export {MDCTopAppBar, MDCTopAppBarFoundation, MDCShortTopAppBarFoundation, util};
110+
export {MDCTopAppBar, MDCTopAppBarFoundation, MDCShortTopAppBarFoundation};

packages/mdc-top-app-bar/util.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/unit/mdc-top-app-bar/util.test.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)