Git Product home page Git Product logo

Comments (3)

Gransfall avatar Gransfall commented on June 30, 2024

Hi @dennmat-hurdle,

Did you find a solution ? I'm struggled with that behavior too

from vue-js-modal.

dennmat-hurdle avatar dennmat-hurdle commented on June 30, 2024

I didn't find a workaround to fix this unfortunately.

I ended up changing the behavior of the UI to accommodate this for now but with no reply on this I didn't want to go through making a PR that would likely just sit there as I don't want to fork this and have a version that is stale.

I'm thinking this may be unmaintained at this point so down the line I'll be looking at finding one still in development. I don't have the time to take on maintaining this unfortunately, but I'd be glad to contribute if it were still maintained.

There are 'hacky' solutions you could employ, like always setting clickToClose false and then using JS that watches for dom changes to find whenever a modal is open and then listen for click events yourself there while separately handling key listeners for escape but it's a bit hacky and adds a lot of mental overhead to the codebase for the return I think. So the preferable solution would be the smaller change to the library.

from vue-js-modal.

Gransfall avatar Gransfall commented on June 30, 2024

Hi,

Thanks for your response,
I've find an hacky way. Not Perfect but can be useful to someone.

Basically, you must :

  • set : clickToClose to false
  • use @opened library function
  • set a ref attribute to focus your first field on the modal (if not escape key will not working)
  • bind escape key on the first div on the modal to call a closing function
<modal name="form-modal" :height="'auto'" :width="1600" :shiftY="0" :scrollable="true" :clickToClose="false" @opened="opened" >
        <div class="modal-mp" @keyup.esc="closeModalForm" ...
        
        <input class="form-control" ref="field-name" ....
opened(){
            this.$refs["field-name"].focus();
        }
closeModalForm(){
            this.$modal.hide('form-modal');
        },

After, like you say, the best is maybe to switch the library :/

from vue-js-modal.

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.