Table sorting accessibility for AngularJS table/list
Has your SPA accessibility compliance done ?
Ahhh … let me get back to you.
That’s usual scenario for dynamic single page application. Since content of the web app changes dynamically/asynchronously. It required need addition planning to make dynamic web accessibility complain. For those who are new to web accessibility
The power of the Web is in its universality. Access by everyone
regardless of disability is an essential aspect.
There are many tools are being provided to make the web accessible like screen reader. The screen reader read out the html content with help of aria attributes. One of the accessibility attribute is aria-sort . It let the user know that the given html table is sorted by of the its column and in which order. The sorted column of the table expected to have ng-aria=”ascending/descending”.
The problem with SPA table is that on sorting the table the content get sorted without loading the web, so having static aria-sort attribute is going to help. The aria-sort attribute should get updated as the user interact with html table.
To solve this problem I have come up with angular directive to add/update aria-sort attribute dynamically to table header.
var ngAria = angular.module("NGAria", []);
ngAria.directive('ngAriaSort', function(){
return {
restrict:'A',
scope:{
orderBy : "="
},
link: function(scope, element, attrs, ctrl){
if(attrs.ngAriaSort) {
try {
var currentCol = attrs.ngAriaSort;
updateAriaAttribute();
scope.$watch('orderBy', function(newVal, oldVal){
updateAriaAttribute();
},true);
} catch(e) {
console.warn('Error while paring sn-aria-sort attribute value : ' + e.toString());
}
}
function updateAriaAttribute() {
var isSorted = scope.orderBy.col == currentCol;
var desc = scope.orderBy.desc;
if(isSorted)
element.attr('aria-sort',desc?"descending":"ascending");
else
element.removeAttr('aria-sort');
}
}
}
});
Here is how this directive is being used
<thead>
<tr>
<th ng-repeat="col in cols" ng-aria-sort="{{col.name}}" order-by="orderBy">
It adds/updates the aria-sort attribute based on the current column by which the table is sorted as well as the sorting order.
Code Link is here
ReplyDeleteIt is a great post. Thanks for sharing such kind of noteworthy posts. Keep updating.
AngularJS Training in Chennai | AngularJS Training Institute in Chennai
Awesome article. Thanks for sharing.
DeleteAngularJS Training in Chennai
It is an awesome post. A debt of gratitude is in order for sharing such sort of important posts. Continue refreshing.
ReplyDeleteEducation | English Labs | MBA Talks | Technology
Thanks for sharing such a useful information. It is really impressive and useful. I like your blog and suggested to my friends too. Keep sharing. If anyone wants to learn Angular JS course online, please visit below site:
ReplyDeleteangular js Online Training | angular js course | angular js online training in kurnool | angular js online training in hyderabad | angular js online training in bangalore | online courses | online learning | online education | trending courses | best career courses
It is a great article for AngularJS. Thanks for sharing this useful information.
ReplyDeleteAngularJS Training in Chennai | AngularJS Course in Chennai | AngularJS Training Institute in Chennai
Informative blog thanks for providing such a great information.
ReplyDeleteAngularJS Training in Chennai | AngularJS Training Institute in Chennai
Amazing Blog.The content is very useful. Pls update more.
ReplyDeleteAngularjs Training in Chennai
Angularjs course in Chennai
Angular 2 Training in Chennai
Angular 4 Training in Chennai
Angular Training in Chennai
Very nice blog, Thank you for providing good information.
ReplyDeleteAngularjs Training center in Chennai
Angularjs Training Chennai
Awesome Post. Thanks for Sharing. Kepp updating.
ReplyDeleteHtml5 Training in Chennai
Html5 Courses in Chennai
Html5 Training
Html5 Course
Html5 Training Course
This article is very much helpful and i hope this will be an useful information for the
ReplyDeleteneeded one. Keep on updating these kinds of informative things...
englishlabs
Technology
I feel really happy to have seen your webpage and look forward to so many more entertaining times
ReplyDeletereading here. Thanks once more for all the details.
Data science Course
Training in Chennai |Best Data Science Training Institute in Chennai
RPA Course
Training in Chennai |Best RPA Training Institute in Chennai
AWS Course Training
in Chennai |Best AWS Training Institute in Chennai
Devops Course Training
in Chennai |Best Devops Training Institute in Chennai
Selenium Course Training in
Chennai |Best Selenium Training Institute in Chennai
Java Course Training in Chennai |
Best Java Training Institute in Chennai
It’s always so sweet and also full of a lot of fun for me personally and my office colleagues to search your blog a minimum of thrice in a week to see the new guidance you have got.
ReplyDeleteBest PHP Training Institute in Chennai|PHP Course in chennai
Best .Net Training Institute in Chennai
Dotnet Training in Chennai
Dotnet Training in Chennai
wonderfull article...
ReplyDeleteforeach loop in node js
ywy cable
javascript integer max value
adder and subtractor using op amp
"c program to find frequency of a word in a string"
on selling an article for rs 1020, a merchant loses 15%. for how much price should he sell the article to gain 12% on it ?
paramatrix interview questions
why you consider yourself suitable for the position applied for
Nice Blog..
ReplyDeletehow to hack with crosh
javascript integer max
apply css to iframe content
given signs signify something and on that basis assume the given statement to be true
zeus learning aptitude paper for software testing
how to hack wifi hotspot on android
she most of her time tomusic
unexpected token o in json at position 1
ywy
javascript sort array of objects by key value
Nice Information....
ReplyDeleteIntern Ship In Chennai
Inplant Training In Chennai
Internship For CSE Students
Online Internships
Coronavirus Update
Internship For MBA Students
iot internship
This is an awesome blog that I could ever seen.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
ReplyDeleteHii sir,
Maine aapki website dekhi joki bhut hi kamaal ki hai aur aapki sabhi jankari kafi achi hai.
Mai bhi likhta hun aur meri site abhi grow kr rhi hai
Aur mai chahta hun ki aap mere sath Do-Follow backlink Exchang kare taki hmare Site ki DA badhe
Par mai apko btana chahta hun ki Mera to fayada hoga hin isme koi shaq nhi hai par aapko bhi ek Do Follow back link milega joki apke website ke liye ek Positive Signal hoga
Aapka Busy time dene ke liye thankyou
Regards -Love U Nature
Website : https://loveyounature.blogspot.com/
Thanks for sharing such a great blog
ReplyDeleteVermicompost manufacturers in Tamilnadu | Vermicompost in Tamilnadu
Vermicompost Manufacturers | Vermicompost Suppliers
Vermicompost in Coimbatore | Vermicompost manufacturers in Chennai
Vermicompost in chennai | Best Vermicompost in chennai
Thank you for sharing valuable information.
ReplyDeleteAngularjs online training
Fake Bank Statement
ReplyDeleteFake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
ReplyDeleteFake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
Fake Bank Statement
The information that you have shared is really useful for everyone.
ReplyDeleteData Science Online Training
Python Online Training
I am reading the whole article it is very useful and there is a lot to learn. I bookmarked your blog. Waiting for the next post. Know about new technology visit our website Top 10 in history
ReplyDeletemonitors for gaming
ReplyDeletebest gaming laptops
best lightweight strollers
best baby strollers
Exceptional Blog! Generally I don’t read post on blogs, but I wish to say that this write-up very compelled me to try and do so! Your writing style has been surprised me. Thanks, very nice post. Regards :Create Sankey Diagram. Look at my articles and share your feedback : Read more here.
ReplyDeleteGood day. I was impressed with your article. Keep it up . You can also visit my site if you have time. Thank you and Bless you always.
ReplyDeleteoutsource Angularjs Application Development in India
At the point when one purchases any singular Office applications or a one-time buy Office, then, at that point, he/she can get a free item key to introduce the Office. Office Product Key Free
ReplyDeleteIt took me a while to get over all the explanations, but I actually enjoyed the article. It turned out much more favorably for me and I am decided by all the commenters here! Always available from now on, you are not knowledgeable but have fun! Mixed In Key Crack
ReplyDeleteYour hard work is great, and I'm glad you shared it with me.
ReplyDeleteColor Finale Pro
Excellent blog.
ReplyDeleteOrigami paper plane
ReplyDeleteEnroll in our dynamic web designing training! Learn HTML, CSS, JavaScript, responsive design, UI/UX principles, and popular design tools. Gain practical experience through projects and mentorship from industry experts. Launch your career in web design with confidence and creativity!
Nice Article!
ReplyDeleteThanks for sharing with us 🙂
Embedded Systems Course In Hyderabad