Git Product home page Git Product logo

Comments (4)

wwilsman avatar wwilsman commented on June 12, 2024 1

I'm going to close this as I feel you could typically solve this by just using a different selector to target Dropkick specifically.

Where you might currently have something like this:

.input:focus {
  /* ... */
}

You could add a similar class to Dropkick and target it this way:

.input:focus,
.dk-input .dk-selected:focus {
  /* ... */
}

Of course, this might not always be so easy if you're using a CSS framework. In either case, I don't feel like this is a bug as adding classes to the generated markup after initialization was never intended. If you must, I think reattaching it in the change handler as you did should work fine.

from dropkick.

wwilsman avatar wwilsman commented on June 12, 2024

Dropkick allows you to add classes to the select and the individual options to allow for some extra customizations.

Example:
http://jsbin.com/bivudi/edit?html,css,js,output

The reason that line removes the old classes is so previous classes added from other options aren't persisted when the selected option changes.

from dropkick.

Florian-R avatar Florian-R commented on June 12, 2024

Ah, I missed that in the docs. Thanks @wwilsman

from dropkick.

Florian-R avatar Florian-R commented on June 12, 2024

Think I have closed this too soon. On my bin, the input class is attached to the dk-selected div.
On yours, it's attached to the root element (dk-select). It cause some buggy styling in my case as I have some :focuson .input.

One solution could be to pass the option.className to the root element instead (so we can also always reattach the select className to preserve current behavior), but this is a breaking change.

For now, I simply reattach the class on the change handler, a bit ugly but it does the job.

Reopening in case you want to chime in, feel free to close if you don't think there's need for change.

from dropkick.

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.