Skip to content

Commit

Permalink
Fix: accordion observer issues (#982)
Browse files Browse the repository at this point in the history
Quick fix for #981

Mostly a quick patch to the Accordion so that the mutation observer stops causing uncaught errors.

- in `setChildContentHeight`, check that `this.childContent` is truthy before trying to read the `clientHeight` property
- in `setChildContentHeight`, check that `this.childWrapper` is set before trying to use `setAttribute`
  • Loading branch information
w33ble authored Jul 10, 2018
1 parent a776a94 commit 7f8d23c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Fixed some IE11 flex box bugs and documented others (modal overflowing, image shrinking, and flex group wrapping) ([#973](https://github.com/elastic/eui/pull/973))
- Fixed white square that show in double scollbar via `euiScrollBar()` ([989](https://github.com/elastic/eui/pull/989))
- Fixed issue with Accordion would attempt to use properties and accessors on null ([#982](https://github.com/elastic/eui/pull/982))

## [`1.1.0`](https://github.com/elastic/eui/tree/v1.1.0)

Expand Down
4 changes: 2 additions & 2 deletions src/components/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class EuiAccordion extends Component {

setChildContentHeight = () => {
requestAnimationFrame(() => {
const height = this.state.isOpen ? this.childContent.clientHeight : 0;
this.childWrapper.setAttribute('style', `height: ${height}px`);
const height = this.childContent && this.state.isOpen ? this.childContent.clientHeight : 0;
this.childWrapper && this.childWrapper.setAttribute('style', `height: ${height}px`);
});
}

Expand Down

0 comments on commit 7f8d23c

Please sign in to comment.