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

Commit fc0a955

Browse files
committed
fix(top-app-bar): remove icon handlers, fix standard navbar behaviour
1 parent ab83c77 commit fc0a955

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

packages/top-app-bar/index.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import TopAppBarIcon from './Icon';
3030
import {cssClasses} from './constants';
3131
import {MDCFixedTopAppBarFoundation} from '@material/top-app-bar/fixed/foundation';
3232
import {MDCTopAppBarAdapter} from '@material/top-app-bar/adapter';
33-
import MDCTopAppBarFoundation from '@material/top-app-bar/foundation';
33+
import {MDCTopAppBarFoundation} from '@material/top-app-bar/standard/foundation';
3434
import {MDCShortTopAppBarFoundation} from '@material/top-app-bar/short/foundation';
35-
import {EventType, SpecificEventListener} from '@material/base/types';
35+
import {SpecificEventListener} from '@material/base/types';
3636

3737
export type MDCTopAppBarFoundationTypes
3838
= MDCFixedTopAppBarFoundation | MDCTopAppBarFoundation | MDCShortTopAppBarFoundation;
@@ -225,22 +225,10 @@ class TopAppBar<T extends HTMLElement = HTMLHeadingElement> extends React.Compon
225225
deregisterResizeHandler: (handler: SpecificEventListener<'resize'>) => {
226226
window.removeEventListener('resize', handler);
227227
},
228-
registerNavigationIconInteractionHandler: <K extends EventType>(type: K, handler: SpecificEventListener<K>) => {
229-
if (this.topAppBarElement && this.topAppBarElement.current) {
230-
const navIcon = this.topAppBarElement.current.querySelector(`.${cssClasses.NAV_ICON}`);
231-
if (navIcon) {
232-
navIcon.addEventListener(type, handler);
233-
}
234-
}
235-
},
236-
deregisterNavigationIconInteractionHandler: <K extends EventType>(type: K, handler: SpecificEventListener<K>) => {
237-
if (this.topAppBarElement && this.topAppBarElement.current) {
238-
const navIcon = this.topAppBarElement.current.querySelector(`.${cssClasses.NAV_ICON}`);
239-
if (navIcon) {
240-
navIcon.removeEventListener(type, handler);
241-
}
242-
}
243-
},
228+
// onClick handler of navigation bar is used instead
229+
// see https://github.com/material-components/material-components-web/issues/2813
230+
registerNavigationIconInteractionHandler: () => null,
231+
deregisterNavigationIconInteractionHandler: () => null,
244232
notifyNavigationIconClicked: () => {
245233
if (this.props.onNavIconClicked) {
246234
this.props.onNavIconClicked();

0 commit comments

Comments
 (0)