-Additional classes can be added to your dropdown buttons to change their appearance.
+Additional classes can be added to your dropdown buttons to change their appearance and behavior.
-
Some text that people will think is awesome! Some text that people will think is awesome! Some text that people will think is awesome!
+
diff --git a/spec/dropdown/dropdown.js b/spec/dropdown/dropdown.js
index 03b7fc3002..ab4d39ea3a 100644
--- a/spec/dropdown/dropdown.js
+++ b/spec/dropdown/dropdown.js
@@ -23,6 +23,7 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays the dropdown on click', function() {
@@ -33,6 +34,7 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(true);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays the content dropdown on click', function() {
@@ -43,6 +45,7 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(true);
expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
it('closes an open dropdown when another is clicked', function() {
@@ -54,6 +57,7 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(true);
expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
it('closes an open dropdown when the document is clicked elsewhere', function() {
@@ -65,6 +69,7 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays a dropdown even if the dropdown button has deeply nested content', function() {
@@ -75,6 +80,18 @@ describe('dropdown:', function() {
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(true);
+ expect($('#drop4').hasClass('open')).toBe(false);
+ });
+
+ it('does not display a disabled dropdown', function() {
+ $(document).foundation();
+
+ $('#drop4link').click();
+
+ expect($('#drop1').hasClass('open')).toBe(false);
+ expect($('#drop2').hasClass('open')).toBe(false);
+ expect($('#drop3').hasClass('open')).toBe(false);
+ expect($('#drop4').hasClass('open')).toBe(false);
});
});
});
From 7ad937937a2a7725759bec7832b1b4247f153947 Mon Sep 17 00:00:00 2001
From: Dimitri Jorge
Date: Tue, 16 Sep 2014 19:36:04 +0200
Subject: [PATCH 3/9] Fix joyride error
When the joyride is included on the page but hasn't been started yet,
the keystrokes events are still catched and we end up with a JS error
on `go_next` or `go_prev` functions.
This fix checks that the joyride is on screen before calling theses callbacks.
---
js/foundation/foundation.joyride.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/js/foundation/foundation.joyride.js b/js/foundation/foundation.joyride.js
index c0731b051c..9bbe3583c1 100644
--- a/js/foundation/foundation.joyride.js
+++ b/js/foundation/foundation.joyride.js
@@ -111,8 +111,10 @@
this.end(this.settings.abort_on_close);
}.bind(this))
- .on("keyup.joyride", function(e) {
- if (!this.settings.keyboard) return;
+ .on("keyup.fndtn.joyride", function(e) {
+ // Don't do anything if keystrokes are disabled
+ // or if the joyride is not being shown
+ if (!this.settings.keyboard || !this.settings.riding) return;
switch (e.which) {
case 39: // right arrow
From d44fd1882d3af7ca92da3432ec7c0c99048f2c61 Mon Sep 17 00:00:00 2001
From: J Potts
Date: Fri, 26 Sep 2014 13:49:58 +0100
Subject: [PATCH 4/9] Tabs heavy-handed tabindex setting fix
This change is to remove the tabindex attrs instead of setting them to zero on change of tab.
The problem with having a zero tabindex (on a div for example) is that Chrome highlights the area on click and includes it in the tabbable items, so removing the tabindex is a better option as it reverts the tab section to its default tab behaviour.
---
js/foundation/foundation.tab.js | 10 +++++-----
scss/foundation/components/_tabs.scss | 4 ++++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/js/foundation/foundation.tab.js b/js/foundation/foundation.tab.js
index 38943c6e5f..d452096062 100644
--- a/js/foundation/foundation.tab.js
+++ b/js/foundation/foundation.tab.js
@@ -142,9 +142,9 @@
'aria-selected' : null
});
$target.attr({
- 'tabindex' : '0',
'aria-selected' : true
- }).focus();
+ }).removeAttr('tabindex')
+ .focus();
}
// Hide panels
@@ -190,12 +190,12 @@
// window (notably in Chrome).
// Clean up multiple attr instances to done once
tab.addClass(settings.active_class).triggerHandler('opened');
- tab_link.attr({"aria-selected": "true", tabindex: 0});
+ tab_link.attr({"aria-selected": "true"}).removeAttr('tabindex');
siblings.removeClass(settings.active_class)
siblings.find('a').attr({"aria-selected": "false", tabindex: -1});
- target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1}).end().addClass(settings.active_class).attr('aria-hidden', 'false').find(':first-child').attr('tabindex', 0);
+ target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1}).end().addClass(settings.active_class).attr('aria-hidden', 'false').find(':first-child').removeAttr('tabindex');
settings.callback(tab);
- target.children().attr('tab-index', 0);
+ target.children().removeAttr('tabindex');
target.triggerHandler('toggled', [tab]);
tabs.triggerHandler('toggled', [target]);
diff --git a/scss/foundation/components/_tabs.scss b/scss/foundation/components/_tabs.scss
index 8676e0c47a..99124d2819 100644
--- a/scss/foundation/components/_tabs.scss
+++ b/scss/foundation/components/_tabs.scss
@@ -121,3 +121,7 @@ $tabs-vertical-navigation-margin-bottom: 1.25rem !default;
}
}
}
+
+[tabindex="-1"] {
+ outline: none;
+}
From f09d5801f546ab0bd1ff88a0e31c84c4b5327b87 Mon Sep 17 00:00:00 2001
From: Rafi Benkual
Date: Tue, 30 Sep 2014 17:33:47 -0700
Subject: [PATCH 5/9] adds more to accessibility page
---
doc/pages/accessibility.html | 118 ++++++++++++++++++++++++++++++-----
1 file changed, 103 insertions(+), 15 deletions(-)
diff --git a/doc/pages/accessibility.html b/doc/pages/accessibility.html
index c78092f13e..4396bf6dfb 100644
--- a/doc/pages/accessibility.html
+++ b/doc/pages/accessibility.html
@@ -6,20 +6,49 @@
Guidelines on this page will help you make your sites more
Aside from accessibility features that has been built into Foundation's components, this guide will give you additional best practices towards making your site more accessible. This is a living document and will continue to be updated.
-
Care about accessibility or want to contribute? Submit a Pull Request or get into the conversation on GitHub.
+
Care about accessibility or want to contribute? Submit a Pull Request or get into the conversation on GitHub.
`. Subsequent headings should make logical use of `
-
` such that screen readers can construct a table of contents for your pages.
+
+
Images should have text alternative for images. Captions or transcripts should be provided for video and audio. Sufficient color contrast between text and background is important for people with vision impairment or color blindness.
+
Sites should be navigatable using only a keyboard, providing meaningful hyperlinks, and allowing enough time for users to complete a task.
+
Make content readable and provide predictable functionality.
+
Maximizing compatibility with current and future tools (web browsers, assistive technologies, etc.).
+
+
+***
+## Keyboard Access
+
+
The most common impairments for web users are those with problems seeing, hearing or a physical inability to use a mouse. For that reason, the site must be navigatable by keyboard. Most commonly the tab key is used to tab through the content. For a vision impaired person will have a screenreader installed that reads the content out loud. We used Chromevox to test with. You can find a list of popular screen readers below in the resource list.
+
+### Tab-index
+
+
Tab index lets users move forward and backward through the links and form elements on a page. But you can make anything "tabbable" with the tabindex attribute.
+
+{{#markdown}}
+```html
+
…
+
+…
+
+
…
+```
+{{/markdown}}
+
+
As the numbers suggest, tapping on the tab key takes users through anything with the tabindex attribute in order. In HTML5, you can use it on any element. That means you can set priorities quickly. Want to help people get past the same tedious navigation they get on every page? Use tabindex to put navigation last.
+
+
Tip: When starting out use sets of 10: tabindex="10", tabindex="20", tabindex="30". If you decide to rearrange the order — say, put the third item between the first and second — you don't have to rearrange everything. Just make it tabindex="15".
-## How to Test a Website’s Keyboard Accessibility
-On a desktop or laptop in Firefox, IE, Chrome, or Safari,
-click into the browser address bar.
+### How to Test a Website’s Keyboard Accessibility
-Take your hand off your mouse and use only your keyboard.
-Using the Tab button, navigate until you’ve reached the link below. (You can use Shift+Tab to navigate back one step.)
+
On a desktop or laptop in Firefox, IE, Chrome, or Safari,
+click into the browser address bar.
+
+
Take your hand off your mouse and use only your keyboard.
+Using the Tab button, navigate until you’ve reached the link below. (You can use Shift+Tab to navigate back one step.)
Right arrow: Next navigation bar item
@@ -27,11 +56,70 @@
Guidelines on this page will help you make your sites more
Enter: Activate currently focused item (i.e. navigate to corresponding URL)
Give the person the ability to skip the navigation at the top of the page. If you have menu with 40 links, you can imagine how long it would take someone to tab through all that. Here's one way to do it: