-
Notifications
You must be signed in to change notification settings - Fork 1k
Ch1972 add accessibility check for checkbox and radio #1996
Ch1972 add accessibility check for checkbox and radio #1996
Conversation
…adding unit tests
…ests 'more correctly'
…and ok/notOk instead of equals
…checkbox is hidden or collapsed.
…nd-radio-do-not-have-tabindex
…unctional programming pattern (actually uses passed in var)
…instead of just one of those twice
…of checkbox tests and weren't actually even running in some instances somehow
I really like this proactive check. You might consider some kind of production/dev env check, but I think you can only do that in CommonJS not ES5. |
index.js
Outdated
if (window.console && window.console.clear) { | ||
window.console.clear(); | ||
} | ||
// if (window.console && window.console.clear) { |
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.
Just remove it, if you don't want it.
…add-accessibility-check-for-checkbox
…b.com:cormacmccarthy/fuelux into CH1972---add-accessibility-check-for-checkbox
js/scheduler.js
Outdated
// -- END UMD WRAPPER PREFACE -- | ||
|
||
// -- BEGIN MODULE CODE HERE -- | ||
if (!$.fn.combobox || !$.fn.datepicker || !$.fn.radio || !$.fn.selectlist || !$.fn.spinbox) { |
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.
I don't think any of these namespace checks should be in the bundled code, since the code is known to be there. You've moved it into the bundled library in multiple place.
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.
I literally just moved it down below the UMD wrapper comment... Are you saying that somehow changed the way it gets bundled?
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.
I'm saying that if you move it into the -- BEGIN MODULE CODE HERE --
part then it WILL get into the bundle, instead of just used when you require the one control.
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.
Wait, so you're telling me that the bundle gets generated in part based on a comment in the code?
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.
Yes, the bundle is created with concat. We couldn't do require
or ES6 import, etc.
https://github.com/ExactTarget/fuelux/blob/master/grunt/config/concat.js#L32
require('./checkbox-tests/return')(QUnit); | ||
require('./checkbox-tests/get-value')(QUnit); | ||
require('./checkbox-tests/events')(QUnit); | ||
require('./checkbox-tests/visibility')(QUnit); |
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.
if we are skipping the visibility tests, then should we comment this line out so no one sees it.
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.
Well, the point of making it .skip
is that you alert the person that "there's a thing that maybe ought to be tested, but actually isn't". That way they can either add the test, or go test it themselves. If we comment it out, we might as well just remove it... Any thoughts @futuremint (Dave is the one who told me to add the skip tests)?
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.
How about something like "skipped intentionally, future work" added to the test name.
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.
Looking closer at this, checkbox visibility tests are fully defined. Not sure where you are seeing it is skipped? Tree is the only thing that has skipped tests (and those were added by a different PR).
Another option is to label the "bad checkboxes" as "THIS MARKUP IS WRONG" or something. |
…at gets bundled into all.js where it would be innapropriate
The skipped tests were added in a different PR, but I've documented them in this PR a little in response to your request for them to be removed. In #2000 I fleshed a few of them out more. It's important for them to be there as an indicator that there is functionality that isn't actually being tested (that in a perfect world would be). That way, if the PR or change someone is working on has anything to do with those things (this PR doesn't...), they'll know that those things need tested more carefully manually by both the dev and the reviewer(s) and/or those tests need fleshed out. |
…ssibility-check-for-checkbox
Oops! I always forget that index.html is anything other than just a place to do testing. Will fix, thanks. |
Fixes #1972
Adds a console error message if
visibility: hidden
orvisibility: collapse
is applied to the checkbox.Cleans up checkbox unit tests and makes UMD wrapper more consistent across all core fuel ux files.
If you are getting the following error:
For accessibility reasons, in order for tab and space to function on [checkbox|radio],
visibilitymust not be set to
hiddenor
collapse. See https://github.com/ExactTarget/fuelux/pull/1996 for more details.
It means that your code (probably in the CSS) is inappropriately setting the checkbox or radio
visibility
tohidden
orcollapse
. You can fix it by:display
tonone
on pageload. Or (worst-case) add a data attributedata-ignore-visibility-check=true
or pass an option on init$yourCheckbox.checkbox({ignoreVisibilityCheck: true})
to make checkbox ignore the error.