question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Carousel Not work IE11

See original GitHub issue

Issue description

  • components: Carousel
  • reactstrap version 5.0.0-alpha.4
  • import method umd/csj/es (if umd, are you using the “full” version (only for v5+)?)
  • react version 16.2.0
  • bootstrap version 4.0.0-alpha.6

What is happening?

Carousel Not work IE11when click in carousel-indicators page failed

What should be happening?

Steps to reproduce issue

Error message in console

paste error message with stacktrack here

Code

class Sliderr extends Component {
    constructor(props) {
        super(props);
        this.state = { activeIndex: 0 };
        this.next = this.next.bind(this);
        this.previous = this.previous.bind(this);
        this.goToIndex = this.goToIndex.bind(this);
        this.onExiting = this.onExiting.bind(this);
        this.onExited = this.onExited.bind(this);
    }

    onExiting() {
        this.animating = true;
    }

    onExited() {
        this.animating = false;
    }

    next() {
        if (this.animating) return;
        const nextIndex = this.state.activeIndex === items.length - 1 ? 0 : this.state.activeIndex + 1;
        this.setState({ activeIndex: nextIndex });
    }

    previous() {
        if (this.animating) return;
        const nextIndex = this.state.activeIndex === 0 ? items.length - 1 : this.state.activeIndex - 1;
        this.setState({ activeIndex: nextIndex });
    }

    goToIndex(newIndex) {
        if (this.animating) return;
        this.setState({ activeIndex: newIndex });
    }

    render() {
        const { activeIndex } = this.state;

        const slides = items.map((item) => {
            return (
                <CarouselItem
                    onExiting={this.onExiting}
                    onExited={this.onExited}
                    key={item.src}
                >
                    <img src={item.src} alt={item.altText} />

                    <CarouselCaption captionText={item.description} captionHeader={item.caption} />
                </CarouselItem>
            );
        });

        return (
            <Carousel
                activeIndex={activeIndex}
                next={this.next}
                previous={this.previous}
            >
                <CarouselIndicators items={items} activeIndex={activeIndex} onClickHandler={this.goToIndex} />
                {slides}
                <CarouselControl direction="prev" directionText="Previous" onClickHandler={this.previous} />
                <CarouselControl direction="next" directionText="Next" onClickHandler={this.next} />
            </Carousel>
        );
    }
}


export default Sliderr;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
supergibbscommented, Feb 26, 2018

The failing code is: https://github.com/reactstrap/reactstrap/blob/eea7d1b10b0367047b084a17b9746256a10df279/src/CarouselItem.js#L42

Through https://github.com/sindresorhus/devtools-detect/issues/9 and https://stackoverflow.com/questions/19345392/why-arent-my-parameters-getting-passed-through-to-a-dispatched-event/19345563 it seems we need a polyfill for IE9+ https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill

(function () {
  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: undefined };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;
   }

  CustomEvent.prototype = window.Event.prototype;

  window.CustomEvent = CustomEvent;
})();
2reactions
supergibbscommented, Feb 26, 2018

I am pro not needing polyfills. In the meantime, I confirmed the above one works for this issue on IE11.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Carousel CSS works in IE 11 but nothing else, different CSS ...
The carousel has an image preview for next and previous images. Selecting previous or next should cause a smooth transition to previewed image. ......
Read more >
[BS4] Carousel not working well in IE11. · Issue #22198 - GitHub
I'm seeing several issues with the carousel in IE11. Transitions don't really work; Indicators are a bit of to the right; During transition, ......
Read more >
Flexbox with IE11 - Adobe Support Community - 9819874
Solved: I'm having some issues with compatibility in IE11 and flexbox. My site is working correctly in Chrome, Firefox, Edge but not IE....
Read more >
Embedded Reports not working in IE11
I am embedding the powerBI reports and dashboards in my single page angular7 application. In my home page there is a carousel where...
Read more >
Carousel Transition not working in IE 11 and 10 - MDBootstrap
The Carousel slide transition isn't working in IE 11,10. Is there something specific I might be missing in order to get this to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found