Giter Site home page Giter Site logo

Autofocus problem about bs-stepper HOT 6 CLOSED

johann-s avatar johann-s commented on August 10, 2024
Autofocus problem

from bs-stepper.

Comments (6)

lcsqlpete avatar lcsqlpete commented on August 10, 2024

I figured out what was happening. It appears that shown.bs-stepper doesn't fire when the stepper is first displayed so my .focus() wasn't happening on the first tab but does work on the other two tabs. I got round the issue by issuing .focus() for the first tab in the shown.bs.modal event.

I'm not an expert on this stuff but is there a case for shown.bs-stepper being fired when a stepper is initialized?

from bs-stepper.

Johann-S avatar Johann-S commented on August 10, 2024

Hi @lcsqlpete,

bs-stepper trigger the shown event on init too, see this CodePen: https://codepen.io/Johann-S/pen/PMzRbw

from bs-stepper.

lcsqlpete avatar lcsqlpete commented on August 10, 2024

Thanks, I see the CodePen works. However, my code doesn't. Here it is:

element.addEventListener('shown.bs-stepper', function (event) {
        console.log("index=" + event.detail.indexStep)
        switch (event.detail.indexStep) {
            case 0:
                handleStep_1()
                break
            case 1:
                handleStep_2()
                break
            case 2:
                handleStep_3()
                break
        }
    })

When I open the page containing the stepper, I don't see anything in the console log; when I go to my second tab, I see "index=1" in the console.log.

Any ideas?

from bs-stepper.

Johann-S avatar Johann-S commented on August 10, 2024

Maybe you added your listener after the creation of your stepper, you have to add your listener before creating your stepper

from bs-stepper.

lcsqlpete avatar lcsqlpete commented on August 10, 2024

from bs-stepper.

Johann-S avatar Johann-S commented on August 10, 2024

You're welcome 👍

from bs-stepper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.