Skip to content

Commit

Permalink
Make close icon accessible [#260]
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Nov 16, 2016
1 parent c454ed8 commit 8f160d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/featherlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
background: #fff; /* Set the background in case it overlaps the content */
background: rgba(255, 255, 255, 0.3);
color: #000;
text-decoration: inherit;
}


Expand Down
4 changes: 2 additions & 2 deletions src/featherlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
$background = $(self.background || [
'<div class="'+css+'-loading '+css+'">',
'<div class="'+css+'-content">',
'<span class="'+css+'-close-icon '+ self.namespace + '-close">',
'<a href="#" class="'+css+'-close-icon '+ self.namespace + '-close" aria-label="Close">',
self.closeIcon,
'</span>',
'</a>',
'<div class="'+self.namespace+'-inner">' + self.loading + '</div>',
'</div>',
'</div>'].join('')),
Expand Down
8 changes: 8 additions & 0 deletions test/featherlight_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,13 @@ var stubAjaxLoad = function(content) {
});
});

describe('accessibility', function() {
it('has a focusable close button', function() {
$.featherlight({text: 'Hello'});
close = $('.featherlight-close-icon')
close.focus();
expect($(document.activeElement)).to.have.class('featherlight-close-icon');
});
});
});
}(jQuery));

0 comments on commit 8f160d2

Please sign in to comment.