Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Improving aria-label warnings #344

Closed
wants to merge 2 commits into from
Closed

Conversation

marcysutton
Copy link
Contributor

When a button, checkbox, radio button or slider is missing alternative text, warnings are logged to the developer telling them about the problem and directing them to the live node requiring a fix.

Closes #342

@marcysutton marcysutton added a11y This issue is related to accessibility type: bug labels Sep 30, 2014
@marcysutton marcysutton changed the title Improving aria-label warnings WIP: Improving aria-label warnings Sep 30, 2014
@ThomasBurleson
Copy link
Contributor

@marcysutton - as part of #340 [Refactor to use ngAria], we need to move these service methods to Utils and not use a custom $aria material service (since it conflicts). This also impacts #314.

@marcysutton
Copy link
Contributor Author

Ok. I figured the service would just be renamed.

@ThomasBurleson
Copy link
Contributor

If we want to use $log, then we need a service. So perhaps just renaming it $materialAria is a good start.

We could even inject the $aria service (from ngAria) and then extend() our own service with ngAria's features.

@marcysutton
Copy link
Contributor Author

@ThomasBurleson any input on the timing issue mentioned above?

@ThomasBurleson
Copy link
Contributor

@marcysutton - can I voip with you tomorrow AM after 11:00 AM CST?
We can discuss the timing issue and solution(s).

@marcysutton marcysutton force-pushed the wip-aria-label-warnings branch 4 times, most recently from e582b55 to 94a233c Compare October 3, 2014 00:30
@@ -12,6 +12,8 @@ describe('material-slider', function() {
};
}

// beforeEach(TestUtil.mockRaf);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding TestUtil.mockRaf here causes the existing tests to fail. But without it, $materialAria.expect does not run.

@marcysutton marcysutton changed the title WIP: Improving aria-label warnings Improving aria-label warnings Oct 3, 2014
var defaultValueTemplate = 'Default value was set: %s="%s".';

return {
expect : expectAttribute,
expect : $$rAF.debounce(expectAttribute),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajoslin @ThomasBurleson This causes an issue when there is more than one component of the same type on a page: $materialAria.expect only executes for the last instance. Need to figure out a way to delay expectAttribute from running but still execute for every component that needs it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. right.

Just do:

function expectAttribute() {
  $$rAF(function() {
    //expectAttribute logic
  });
}

@marcysutton marcysutton force-pushed the wip-aria-label-warnings branch 3 times, most recently from bca0431 to bad82be Compare October 8, 2014 22:17
element.attr(attrName, defaultValue);
} else {
// $log.warn(messageTemplate, attrName, getTagString(node));
function expectAttribute(element, attrName, copyElementText, defaultValue) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing false for copyElementText will accommodate components requiring a warning for aria-label if the developer forgot, such as material-slider. Passing true will try to copy the element's text (or use the optional defaultValue, like in the case of material-dialog). I'm open to renaming this parameter to something that sounds more boolean (or refactoring).

@@ -1,4 +1,4 @@
var DocsApp = angular.module('docsApp', ['ngMaterial', 'ngRoute', 'angularytics'])
var DocsApp = angular.module('docsApp', ['ngMaterial', 'ngRoute', 'angularytics', 'ngAria'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We include ngAria as a dependency of ngMaterial itself now, so this is extraneous.

@ajoslin
Copy link
Contributor

ajoslin commented Oct 17, 2014

Merged via 3368c93.

@ajoslin ajoslin closed this Oct 17, 2014
@marcysutton marcysutton deleted the wip-aria-label-warnings branch October 28, 2014 17:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buttons without text are inaccessible
3 participants