Coder Social home page Coder Social logo

Comments (6)

ghinda avatar ghinda commented on May 26, 2024

The problem is that if you select the label text and then release the mouse button, the radio button is not getting selected.

I think it's caused by the actual text selection, because if I disable it with css, it seems to work:
http://jsbin.com/duwono/edit?html,css,output

Could you try out the demo above and let me know if it works better for you?

I would like to avoid adding a JavaScript dependency, and disabling text selection could be an accessibility issue, so I would still like to find a better way.

from css-toggle-switch.

danielHalan avatar danielHalan commented on May 26, 2024

Yes, the css trick is keeping the state right... works good as an initial workaround at least, but yes it can be an issue with accessibility...

One road to explore is onclick/checkstate life-cycle, try to fire event after the state has changed, or an event with the new state as param

from css-toggle-switch.

ghinda avatar ghinda commented on May 26, 2024

I'm going to close this for now, since I couldn't find a different CSS work-around, and don't want to introduce accessibility issues because of disabling text selection.

If more people report this, I'll probably add user-select: none by default.

In the meanwhile, you can use:

.switch-light,
.switch-toggle label {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

from css-toggle-switch.

ghinda avatar ghinda commented on May 26, 2024

I'm working on a fix for this on the material branch, so I'm re-opening it.

from css-toggle-switch.

danielHalan avatar danielHalan commented on May 26, 2024

Great

from css-toggle-switch.

ghinda avatar ghinda commented on May 26, 2024

Released 4.0.0. Text selection is disabled on the switch-light "on/off" text now, so swiping the switch-light widget will work.

switch-toggle still needs the code above, because I didn't want to disble text selection on it.

from css-toggle-switch.

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.