diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d770633b..a5afb66a71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix Teams Icons styles to match spec @codepretty ([#441](https://github.com/stardust-ui/react/pull/441)) - Fix styles as functions in shorthands are not applied @mnajdova ([#470](https://github.com/stardust-ui/react/pull/470)) - Add `lodash` typings and fix compilation errors @Bugaa92 ([#438](https://github.com/stardust-ui/react/pull/438)) +- Remove unsafe `listRef` from `List` API @kuzhelov ([#489](https://github.com/stardust-ui/react/pull/489)) ### Features - Make `Grid` keyboard navigable by implementing `gridBehavior` @sophieH29 ([#398](https://github.com/stardust-ui/react/pull/398)) diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index 58b22c7502..55d7007a24 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -26,9 +26,6 @@ export interface ListProps extends UIComponentProps, ChildrenComponent /** Shorthand array of props for ListItem. */ items?: ShorthandValue[] - /** Ref callback with the list DOM node. */ - listRef?: (node: HTMLElement) => void - /** A selection list formats list items as possible choices. */ selection?: boolean @@ -70,7 +67,6 @@ class List extends UIComponent, ListState> { selection: PropTypes.bool, truncateContent: PropTypes.bool, truncateHeader: PropTypes.bool, - listRef: PropTypes.func, renderItem: PropTypes.func, } @@ -91,10 +87,6 @@ class List extends UIComponent, ListState> { private focusHandler: ContainerFocusHandler = null private itemRefs = [] - private handleListRef = (listNode: HTMLElement) => { - _.invoke(this.props, 'listRef', listNode) - } - actionHandlers: AccessibilityActionHandlers = { moveNext: e => { e.preventDefault() @@ -123,7 +115,6 @@ class List extends UIComponent, ListState> { {...accessibility.keyHandlers.root} {...rest} className={classes.root} - ref={this.handleListRef} > {childrenExist(children) ? children : this.renderItems()}