Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use <button type='button'> instead of <a href='#'> for accessibility issues #228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ h2 {
margin-bottom: 40px;
}

button {
border: 0;
font-size: inherit;
font-family: inherit;
cursor: pointer;
background: transparent;
}

button::-moz-focus-inner {
border: 0;
padding: 0;
}

#wrapper {
padding: 20px;
}
Expand Down Expand Up @@ -62,7 +75,6 @@ p,h3,h4,pre {
list-style: none;
margin: 0 auto 50px;
max-width: 540px;
padding: 10px 0;
text-align: center;
width: 100%;
}
Expand All @@ -73,22 +85,18 @@ p,h3,h4,pre {
margin-right: 1px;
}

.rslides_tabs a {
width: auto;
line-height: 20px;
.rslides_tabs button {
padding: 9px 20px;
height: auto;
background: transparent;
display: inline;
line-height: 20px;
color: #fff;
}

.rslides_tabs li:first-child {
margin-left: 0;
}

.rslides_tabs .rslides_here a {
.rslides_tabs .rslides_here button {
background: rgba(255,255,255,.1);
color: #fff;
font-weight: bold;
}

Expand Down Expand Up @@ -207,21 +215,26 @@ h3 {
right: 0;
}

#slider3-pager a {
display: inline-block;
#slider3-pager {
padding: 9px;
}

#slider3-pager img {
float: left;
#slider3-pager li {
display: inline;
padding: 0 6px;
}

#slider3-pager .rslides_here a {
#slider3-pager button {
padding: 0;
}

#slider3-pager .rslides_here button {
background: transparent;
box-shadow: 0 0 0 2px #666;
}

#slider3-pager a {
padding: 0;
#slider3-pager img {
vertical-align: bottom;
}

@media screen and (max-width: 600px) {
Expand Down
6 changes: 3 additions & 3 deletions demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ <h2>Simple &amp; lightweight responsive slideshow plugin (in 1kb)</h2>

<!-- Slideshow 3 Pager -->
<ul id="slider3-pager">
<li><a href="#"><img src="images/1_thumb.jpg" alt=""></a></li>
<li><a href="#"><img src="images/2_thumb.jpg" alt=""></a></li>
<li><a href="#"><img src="images/3_thumb.jpg" alt=""></a></li>
<li><button type="button"><img src="images/1_thumb.jpg" alt=""></button></li>
<li><button type="button"><img src="images/2_thumb.jpg" alt=""></button></li>
<li><button type="button"><img src="images/3_thumb.jpg" alt=""></button></li>
</ul>


Expand Down
2 changes: 0 additions & 2 deletions responsiveslides.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@

.rslides li:first-child {
position: relative;
display: block;
float: left;
}

.rslides img {
display: block;
height: auto;
float: left;
width: 100%;
Expand Down
10 changes: 4 additions & 6 deletions responsiveslides.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
var n = i + 1;
tabMarkup +=
"<li>" +
"<a href='#' class='" + slideClassPrefix + n + "'>" + n + "</a>" +
"<button type='button' class='" + slideClassPrefix + n + "'>" + n + "</button>" +
"</li>";
});
$pager.append(tabMarkup);
Expand Down Expand Up @@ -213,7 +213,7 @@

// If we have a pager, we need to set up the selectTab function
if (settings.pager || settings.manualControls) {
$tabs = $pager.find('a');
$tabs = $pager.find('button');

// Select pager item
selectTab = function (idx) {
Expand Down Expand Up @@ -271,7 +271,6 @@
// Pager click event handler
if (settings.pager || settings.manualControls) {
$tabs.bind("click", function (e) {
e.preventDefault();

if (!settings.pauseControls) {
restartCycle();
Expand Down Expand Up @@ -308,8 +307,8 @@
// Navigation
if (settings.nav) {
var navMarkup =
"<a href='#' class='" + navClass + " prev'>" + settings.prevText + "</a>" +
"<a href='#' class='" + navClass + " next'>" + settings.nextText + "</a>";
"<button type='button' class='" + navClass + " prev'>" + settings.prevText + "</button>" +
"<button type='button' class='" + navClass + " next'>" + settings.nextText + "</button>";

// Inject navigation
if (options.navContainer) {
Expand All @@ -323,7 +322,6 @@

// Click event handler
$trigger.bind("click", function (e) {
e.preventDefault();

var $visibleClass = $("." + visibleClass);

Expand Down
8 changes: 1 addition & 7 deletions responsiveslides.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.