Permalink
Browse files

Merge pull request #30 from pmclanahan/master

Add keyboard support to buttons.
Move images to a single sprites image.
Fix bug 747532 747963.
  • Loading branch information...
2 parents 77b7f65 + c522d8b commit 83aecb5576eee63e96d332d03bff0f727f42f021 @pmac pmac committed Jun 5, 2012
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Deleted file not rendered
Oops, something went wrong.
Oops, something went wrong.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Deleted file not rendered
View
@@ -6,24 +6,19 @@
var toggle = '[data-toggle="socialshare"]';
var share_selector = '.socialshare';
- var fb_iframe = '.socialshare.open[data-type="small-bubbles"] .share-options div.fb-like iframe';
+ var fb_iframe = '.socialshare.open[data-type="small-bubbles"] #share-options div.fb-like iframe';
var $share_container;
var packaged_html = '' +
'<div class="dropdown-toggle" data-toggle="socialshare">' +
- ' <div class="share-link"><div>' +
- ' <div class="heart"></div>' +
- ' <p class="text">Share This</p>' +
- ' <div class="caret"><div></div></div></div>' +
- ' </div><div class="clear">' +
- '</div>' +
- '<div class="share-options">' +
- ' <ul>' +
- ' <li><div class="fb-like"></div></li>' +
- ' <li><div class="g-plusone"></div></li>' +
- ' <li><a href="https://twitter.com/share" class="twitter-share-button"></a></li>' +
- ' </ul>' +
- '</div>' +
- '<div id="fb-root"></div>';
+ ' <a class="share-button" role="button" href="#share-options" aria-controls="share-options" aria-expanded="false"><span>Share This</span></a>' +
+ ' <div id="share-options">' +
+ ' <ul>' +
+ ' <li><div class="fb-like"></div></li>' +
+ ' <li><div class="g-plusone"></div></li>' +
+ ' <li><a href="https://twitter.com/share" class="twitter-share-button"></a></li>' +
+ ' </ul>' +
+ ' </div>' +
+ '</div>';
var type;
var providers = {
facebook: {
@@ -85,6 +80,7 @@
var clear_menus = function() {
$(toggle).parent().removeClass('open');
+ $(toggle).find(".share-button").attr("aria-expanded","false");
};
var Dropdown = function(element) {
@@ -104,6 +100,7 @@
clear_menus();
if (!isActive) {
+ $(this).find(".share-button").attr("aria-expanded","true");
$parent.toggleClass('open');
}
$share_container = $(fb_iframe).css('width',
@@ -115,6 +112,7 @@
},
load_sharing: function() {
if (!this.scripts_loaded) {
+ $('body').append('<div id="fb-root" aria-hidden="true"></div>');
for (var key in providers) {
this.load_script(providers[key].src, providers[key].id);
}
@@ -177,11 +175,16 @@
$share_container.find(providers[key].selector)
.attr(providers[key][$share_container.attr('data-type')]);
}
-
- $(document).keypress(function(e) {
- if (e.which === 0 && $share_container.hasClass('open')) {
- clear_menus();
+ $share_container.find(".share-button").keypress(function(e) {
+ if (e.which === 32) {
+ $(this).trigger("click");
+ e.preventDefault();
}
});
+ $(document).keydown(function(e) {
+ if (e.which === 27 && $(".socialshare").hasClass("open")) {
+ $(".share-button").trigger("click");
+ }
+ });
});
})(window.jQuery);
Oops, something went wrong.

0 comments on commit 83aecb5

Please sign in to comment.