-
Notifications
You must be signed in to change notification settings - Fork 644
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
Improved NuGet Gallery's Accessibility #3936
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,29 +39,31 @@ public AccordionHelper(string name, string formModelStatePrefix, bool expanded, | |
public HtmlString ExpandButton(string closedTitle, string expandedTitle) | ||
{ | ||
return new HtmlString( | ||
"<a href=\"#\" class=\"accordion-expand-button btn btn-inline s-expand\" data-target=\"#" + | ||
"<button class=\"accordion-expand-button btn btn-inline s-expand\" data-target=\"#" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the expandable buttons from links into buttons to allow the screen reader to explain their "expanded" vs "collapsed" state through the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, the only difference between Can we move the shared logic to a single function? |
||
ContentDropDownId + | ||
"\" data-toggletext=\"" + | ||
(Expanded ? closedTitle : expandedTitle) + | ||
"\" id=\"" + | ||
CollapseButtonId + | ||
"\">" + | ||
"\" aria-expanded=\"" + | ||
(Expanded ? "true" : "false") +"\">" + | ||
(Expanded ? expandedTitle : closedTitle) + | ||
"</a>"); | ||
"</button>"); | ||
} | ||
|
||
public HtmlString ExpandLink(string closedTitle, string expandedTitle) | ||
{ | ||
return new HtmlString( | ||
"<a href=\"#\" class=\"accordion-expand-link s-expand\" data-target=\"#" + | ||
"<button class=\"accordion-expand-link s-expand\" data-target=\"#" + | ||
ContentDropDownId + | ||
"\" data-toggletext=\"" + | ||
(Expanded ? closedTitle : expandedTitle) + | ||
"\" id=\"" + | ||
CollapseButtonId + | ||
"\">" + | ||
"\" aria-expanded=\"" + | ||
(Expanded ? "true" : "false") + "\">" + | ||
(Expanded ? expandedTitle : closedTitle) + | ||
"</a>"); | ||
"</button>"); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,12 +61,14 @@ | |
var data = $self.data(); | ||
var $target = $(data.target); | ||
var toggletext = data.toggletext || $self.text(); | ||
var expanded = $self.attr('aria-expanded') == 'true'; | ||
var oldText = $self.text(); | ||
|
||
$target.slideToggle('fast', function () { | ||
var oldText = $self.text(); | ||
$self.text(toggletext); | ||
data.toggletext = oldText; | ||
}); | ||
$self.attr('aria-expanded', expanded ? 'false' : 'true'); | ||
$self.text(toggletext); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you go to nuget.org and hit the "Change" buttons on the manage account very quickly, the text toggle could get stuck. This happened because the text was toggled after the transition completed, and hitting the button again during this transition would read the buttons' stale state. |
||
data.toggletext = oldText; | ||
|
||
$target.slideToggle('fast'); | ||
}); | ||
$('.s-confirm[data-confirm]').delegate('', 'click', function (evt) { | ||
if (!confirm($(this).data().confirm)) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -339,7 +339,7 @@ | |
<h5>Select packages</h5><hr /> | ||
To select which packages to associate with a key use a glob pattern, select individual packages, or both. | ||
|
||
<a class="globHelpLink">Example glob patterns</a>. | ||
<a href="#" class="globHelpLink">Example glob patterns</a>. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the |
||
<div class="popup"> | ||
<div class="popupbox" id="addapikeypopup"> | ||
<a class="boxclose"><i class="icon-remove"></i></a> | ||
|
@@ -405,7 +405,7 @@ | |
</div> | ||
</div> | ||
|
||
<button class="btn" type="button" id="generateKey">Add key</button> | ||
<button class="btn" type="button" id="generateKey" aria-disabled="true">Add key</button> | ||
</fieldset> | ||
<br /> | ||
} | ||
|
@@ -535,14 +535,13 @@ | |
var globValid = $('#addkeyglobPattern').valid(); | ||
var globEmpty = $('#addkeyglobPattern').val() == null || $.trim($('#addkeyglobPattern').val()) == ''; | ||
|
||
if (!globValid) { | ||
$('#generateKey').addClass('disabled-div'); | ||
} | ||
else if (packagesWereSelected || !globEmpty) { | ||
if (globValid && (packagesWereSelected || !globEmpty)) { | ||
$('#generateKey').removeClass('disabled-div'); | ||
$('#generateKey').removeAttr('aria-disabled'); | ||
} | ||
else { | ||
$('#generateKey').addClass('disabled-div'); | ||
$('#generateKey').attr('aria-disabled', 'true'); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "link" was changed into a button to allow for the screen reader to explain it's "expanded" vs "collapsed" state. The CSS changes are to make the button look like a link.