icheck.js radio button automatically gets checked when tabbing (32) through form

放肆的年华 提交于 2019-12-25 11:53:05

问题


I am using icheck http://icheck.fronteed.com/ to have fancy radio buttons and check boxes. I am running into an issue though. When I am tabbing through my form and tabbing past the radio button it automatically checks one of the radio buttons.

http://jsfiddle.net/75qmj037/7/

This is an example just tab through the form and see how it automatically checks the radio button. Does anyone know how I can change icheck.js so that this does not happen? I am trying to still be able to tab through the radio buttons but not have it automatically check the first one. I want them to have the same effect as the hover appearance when you tab through just have a ring incase you want to chose them with the spacebar

I have seen other forums saying this is an issue that is being looked into but this is from a few years ago and cannot find a resolution.

Any help with this would be greatly appreciated!

<fieldset class="radio-strip">
    <label class="checked">
      <input name="amt" value="10" type="radio">
      <span class="label-text">$<strong>10</strong></span>
    </label>
    <label>
      <input name="amt" value="25" type="radio">
      <span class="label-text">$<strong>25</strong></span>
    </label>
    <label>
      <input name="amt" value="50" type="radio">
      <span class="label-text">$<strong>50</strong></span>
    </label>
    <label>
      <input name="amt" value="100" type="radio">
      <span class="label-text">$<strong>100</strong></span>
    </label>
  </fieldset>
</body>

jQuery('input').iCheck({
  checkboxClass: 'icheckbox_square-blue',
  radioClass: 'iradio_square-blue',
  increaseArea: '20%' // optional
});

But, there is a problem. How do you distinguish on which radio button are you?


回答1:


You can style radio input elements without the need to jQuery or any plugins.

I removed table structure as it was unnecessary HTML and replaced it with div elements.

See this example (Updated Code):

body {
  background-color: white;
  margin: 0;
  padding: 0;
}
input[type='radio'] {
  display: none;
}
.radio {
  border: 1px solid #b3b4b4;
  border-radius: 50%;
  box-sizing: border-box;
  cursor: pointer;
  display: block;
  float: left;
  height: 16px;
  margin: 10px 10px 0 0;
  padding: 10px;
  position: relative;
  width: 16px;
}
.row:hover .radio {
  border: 2px solid #218996;
}
input[type='radio']:checked + .radio {
  background-color: #218996;
  border: 2px solid #218996;
}
input[type='radio']:checked + .radio::before {
  content: "✓ ";
  position: absolute;
  color: white;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size:
}
.row {
  border-bottom: 1px solid #dcdcdc;
  padding: 0 5px;
}
.row label {
  display: inline-block;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
}
.row > label:last-child {
  padding: 12px 0;
  width: calc(100% - 50px);
  cursor: pointer;
}
<form name="titleTypes" id="titleTypes" method="post" action="process.cfm">
  <div>
    <!---Label is here for placement of error message--->
    <label for="rgroup" class="error" style="display:none;">Please choose one.</label>
  </div>

  <div class='row'>
    <input id="one" type="radio" name="rgroup" value="MV/titleTypeMV.cfm" />
    <label for="one" class='radio' tabindex='1'></label>
    <label for="one">MOTOR VEHICLE / TRAVEL TRAILER TITLE</label>
  </div>

  <div class='row'>
    <input id="two" type="radio" name="rgroup" value="MH/mobileHome.cfm" />
    <label for="two" class='radio' tabindex='1'></label>
    <label for="two">MOBILE HOME</label>
  </div>

  <div class='row'>
    <input id="three" type="radio" name="rgroup" value="BOAT/boat.cfm" />
    <label for="three" class='radio' tabindex='1'></label>
    <label for="three">VESSEL</label>
  </div>

  <div class='row'>
    <input id="four" type="radio" name="rgroup" value="DUPL/duplicate.cfm" />
    <label for="four" class='radio' tabindex='1'></label>
    <label for="four">DUPLICATE</label>
  </div>

  <div>
    <button class="btn-u" type="submit" name="submit" id="submitBtn" class="submitBtn"><i></i>Next</button>
  </div>

This will solve the issue but you have to add tabindex to each element (it could be the same value for all).




回答2:


From MDN:

The tabindex global attribute is an integer indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation, and if so, at what position. It can take several values:

a negative value means that the element should be focusable, but should not be reachable via sequential keyboard navigation;

So, you may set the tabindex to -1 for your radio buttons:

The snippet:

jQuery('input').iCheck({
  checkboxClass: 'icheckbox_square-blue',
  radioClass: 'iradio_square-blue',
  increaseArea: '20%' // optional
});
jQuery('input').attr("tabindex", "-1");
.icheckbox_square-blue,
.iradio_square-blue {
  display: inline-block;
  *display: inline;
  vertical-align: middle;
  margin: 0;
  padding: 0;
  width: 22px;
  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IxQKfqz7Gpvn7F3wp2gSbgtzg/ObxI5HXF/3WQZVN9h+hM9hU4DS9I6GXz7hbr2U0XnJOhfyI/U9+oMVwieICOX+KqpEk/H9NvHXX8vN62CdRaFdPRRKce+m0K/ekGTi1eA+vAHguri7bvU5rLwN8KVoMTYE4Mzau99iT4Mmgz8VuLsb8ZVICVFuZnJQ/Fmw383WI9H+v+dAOnEFwRngZ7wUtxNO8+Nv9Wgwvjdf9H4FvKX2tFal79+/QWcFvzf9qF/fw3+uPObaPx82L5k2AVqItjfurY/CfoUqP770v8GdD9qdnA6Sb2coXcAX4D3NFcQwy0136X+8JhGK++inJ7FvwDbAPlYCbI5ONtfO5s2D5r0KiGfj63mv5Y02Y2fn7VOAqWgvUgO4r5yQbruc9ROoyi+z+Oa+Wl/1HekWM8ju9GYmvSTdyJhlzBu2y0gr9wBWxRfs9dwhX0WfAqWAGCYh4fX7sHvAi2EKP46f+tsvIaNXEnVm19/C+BXImc/mhvqcP56cP8vMHvsj/mvHhBNwjQ6QJFoJLz1ATe4Mpolj5AP2+pY37CKqpb6oxbOPaXFMjBZJkbHk4fxtiO8PYuP2LDlgBhI7ewsStAn8SWIDgENL960zkH/a3gDGjgSaqow0Y/jEbWx78hwviPxzp+NkojaneRV/18iQ3roiDAhvaC1zmfsWTCD3R/ZQR/q5lfuyul1TeEopw+qyzfEI/yWl2rc/9Ix8C7Uj7S+UcjW63/tK6vU6Zt0qRJ5/+eQgtux9fAPAAAAABJRU5ErkJggg==') no-repeat;
  border: none;
  cursor: pointer;
}

.icheckbox_square-blue {
  background-position: 0 0;
}

.icheckbox_square-blue.hover {
  background-position: -24px 0;
}

.icheckbox_square-blue.checked {
  background-position: -48px 0;
}

.icheckbox_square-blue.disabled {
  background-position: -72px 0;
  cursor: default;
}

.icheckbox_square-blue.checked.disabled {
  background-position: -96px 0;
}

.iradio_square-blue {
  background-position: -120px 0;
}

.iradio_square-blue.hover {
  background-position: -144px 0;
}

.iradio_square-blue.checked {
  background-position: -168px 0;
}

.iradio_square-blue.disabled {
  background-position: -192px 0;
  cursor: default;
}

.iradio_square-blue.checked.disabled {
  background-position: -216px 0;
}


/* HiDPI support */

@media (-o-min-device-pixel-ratio: 5/4),
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 120dpi),
  (min-resolution: 1.25dppx) {
    .icheckbox_square-blue,
    .iradio_square-blue {
      background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAAwCAYAAADJnakOAAARTElEQVR4Xu2dC3BUVZ7G/02STkIIDoEkQCQgIcGEpztBHR7iugqjiMwyljAKFjq7IjBW7Za7q+u6DLvD7LhObbG7ozA6tWocWNBdUQd11JnZJcjAQJwRMYRHHoQgr7wQ8n6R/ZL6qk5X93bddG7fvqc751f11aUo0/fn4fzrz7nnXNrzxWe/65UoYvrsWzziQ+7zB6LKv/xv5saUf+mRQ5uibP5s8nEXELX+HH+xQQoyH1mIFCB5SCYyggLNyCXkFFKG7EM+QVp8fMQOqF+xwXA//6lIhp9/LXKS/sXIfqTVpx7t+rs3/vR3Eou55kWykYlIOjKa7l4KdHIONSB1yBmkBukcZO0G+NjAnj997BIvQwmDweBBFiOPIEuRZAlOGpOPLEP+FmlD9iCvIh8hvS75r0Hus/BPREbT/1vIM/T/BfLaoP3N+OcgNyF5SIIEJ5lJR25EFiBdyCnkM6Qymv2x+KhEE+4NVwP2uLQiGejfvnpFZwybNJ07aqVuWI5sRGaJ4mOuqkq50rrEVYtwNZDJldk0ZAGbxwPM533jihp+RyIAm+gm+g+WZGQF8zlWsJuwinwnkuNv25/j74J/PlfrY0VRyZVhLVeKLT4rXC+SwpVlBlebU5BpzEVkL3LCNf/QSfD1x/zfi/kf1N+sgA0GQw6yDbmLAgeQD7iKOi/B6UAa+PiTTUrGc/V2DzIXeRtN+Fe4rkMjrnTQfyuySMLLLIE/mtjHuK5HI6t0evwd8u8ff6f80WTScFnCeQTkLFLOVWyTBKebj/vrfJpsKlefucgEZCWb+PtIoziD8g8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5f84Tw3bH/9Iw/G3488/u1/6vBO8BFmOxDtx2hnBZ8u9FNjHvVyb40//SEP/gc7/eIlVDAbThJ9FytgcH0JuZjP+1zC+57uep52vIuvReHeE2f84/VOFkKeYT5F3+LjyFFLr9x3JGUge93e/FXz1LM1svDscGv+R4iQc/3D5s4H8D5pjHZvjTCQLKUF+F8b3fOfwtHMHG+9RCQ/9/gj9JVGcpYONV/kP0QbcG8HXFkRzDIb/RA6zCdyJbEHu5wrhFeSChMY47g3eg8ylwK+56q2Q8LMDOaT8AyhkBg/9eWDJ2fG3QDf/vn1MNMpzbGKTkW9yv7wC+WwQp75TkZuQXGQCBarUgauw8wWi/J2hKtiBK7MCNhgMFchdyLeRjcg8ZjPyEfIJV5DlyCWkmQIjkHRkKleQC5DFovgc+QHf842k/0yxjfJH4zL+1qejX0cjLuAj/GzmDs6tGs6bRs6dTgp4kRSucDP5M1NEcZGPbMvEWfr9EfrDxTbK3/c9XzsNuNeld74kJjBs0n7uGN5CdrOJPoos5a+RAdOO7OHq+SPudbnpnyRgsP4h7ZUa/zJuCeRwFTsVmcIMlG7kJFfPlYi7/uyBg/UPdf6bFbDBYPaGP2RGIPP5ju107uVm8veFq5la7q0eQ4r5ikfzkPY3/hWMl6vaiUgGV7op/H3hSrgFaeBebDVXy52x4I/mK3aJRzziGvb/J9z2x77LkPXnJNyk9YrVeq5tctPHZZpVM9AO468/naqZ+WP8NX0NyWAwGAwGg4ffwGQwGAwGgyG2V8AGg8FgMBj+D1fi7Wytv5JmAAAAAElFTkSuQmCC');
      -webkit-background-size: 240px 24px;
      background-size: 240px 24px;
    }
  }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.rawgit.com/fronteed/icheck/1.x/icheck.min.js"></script>


<fieldset class="radio-strip">
    <label class="checked">
        <input name="amt" value="10" type="radio">
        <span class="label-text">$<strong>10</strong></span>
    </label>
    <label>
        <input name="amt" value="25" type="radio">
        <span class="label-text">$<strong>25</strong></span>
    </label>
    <label>
        <input name="amt" value="50" type="radio">
        <span class="label-text">$<strong>50</strong></span>
    </label>
    <label>
        <input name="amt" value="100" type="radio">
        <span class="label-text">$<strong>100</strong></span>
    </label>
</fieldset>


来源:https://stackoverflow.com/questions/41125795/icheck-js-radio-button-automatically-gets-checked-when-tabbing-32-through-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!