Coder Social home page Coder Social logo

tiagoporto / accessibility-buttons Goto Github PK

View Code? Open in Web Editor NEW
66.0 9.0 31.0 3.27 MB

Buttons to add/remove contrast and increase/decrease font size.

Home Page: http://tiagoporto.github.io/accessibility-buttons/

License: MIT License

JavaScript 55.86% HTML 2.97% Handlebars 10.88% Stylus 30.29%
buttons accessibility font-size library javascript contrast hacktoberfest

accessibility-buttons's Introduction

Open Source Love

Accessibility Buttons

LIKED ? Leave a : 😞

Release Downloads License

Coverage Status devDependencies Status

Buttons to add/remove contrast and increase/decrease font size.

🇧🇷

Install

npm install accessibility-buttons --save

Usage

Import

  • accessibility-buttons/dist/css/accessibility-buttons.css
  • accessibility-buttons/dist/js/accessibility-buttons.js

Add buttons

<button type="button" data-accessibility="font">+A</button>
<button type="button" data-accessibility="contrast">Add Contrast</button>

Initialize after DOM ready

accessibilityButtons()

Note: Note: Font size works only with em or rem units.

Settings

To set up buttons names and aria-labels, use the following parameters.

// default values
accessibilityButtons({
    font: {
        nameButtonIncrease: '+A',
        ariaLabelButtonIncrease: 'Increase Font',
        nameButtonDecrease: '-A',
        ariaLabelButtonDecrease: 'Decrease Font'
    },

    contrast: {
        nameButtonAdd: 'Add Contrast',
        ariaLabelButtonAdd: 'Add Contrast',
        nameButtonRemove: 'Remove Contrast',
        ariaLabelButtonRemove: 'Remove Contrast'
    }
})

Font size and contrast colors could be customized only overwritting class values.

Example:

body {
    font-size: 1em;
    color: #a9a9a9;
    background: #000;
}

body input,
body textarea,
body select,
body button {
/* The default font-size of these elements is approximately 20% less than the body */
  font-size: 0.9em;
}

body.accessibility-font {
    font-size: 1.5em;
}

body.accessibility-font input,
body.accessibility-font textarea,
body.accessibility-font select,
body.accessibility-font button {
/* The default font-size of these elements is approximately 20% less than the body */
  font-size: 1.2em;
}

body.accessibility-contrast {
    color: #000;
    background: #a9a9a9;
}

Contributing

Check how to contribute.

Credits

Accessibility arial-label tip - Bruno Pulis

Included the $ sign in the variable name of the cached elements for easy identification - Adler Parnas

License

Accessibility Buttons is released under the terms of the MIT license.

accessibility-buttons's People

Contributors

adlerparnas avatar elrafa-sg avatar jeffersonrpn avatar jeffgrammer avatar joycezhu avatar lhphan avatar michelsonlima avatar mindjuice avatar paulohrodrigues avatar tiagoporto avatar wfrsilva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accessibility-buttons's Issues

Extend use with data attribute or class

Hi Tiago!
I hope you are super well,
First of all! Thank you. I'm using your script accessibility buttons, which is excellent.
I would like to know if you could help me with something:
I'm trying to extend the functionality to other elements like data-* or class.
Why? Simple what if i need to put a button in a header and footer or some dummy esthetic thing :P ?
Use the same ID atrib, is like all know, invalid. Both, for the W3c and for all screen readers.
That's why i'm trying to replace the use of the ID by a data-id or class,

I made some adjustments but with no luck. I leave you the Pastebin

Another cool stuff would be use a valid role="switch".

Thank you very much!

IE Edge Issue: SCRIPT16389: SCRIPT16389: Unspecified error.

I am getting an error in IE Edge that "SCRIPT16389: SCRIPT16389: Unspecified error." It's working on all the browsers except Microsoft Edge.

This is my code:

App.controller('home', function(page){

	   if(typeof localStorage !== "undefined"){
		   if (localStorage.getItem("reciepent-list") !== null) {
              
              //var reciepentList = JSON.parse(localStorage.getItem("reciepent-list"));
			   var reciepentList = localStorage.getItem('reciepent-list') ?
				   JSON.parse(localStorage.getItem('reciepent-list')) : 
          [];
              
              $.each(reciepentList, function( index, value ) {
                
                  $(page).find("#contactList").append('<div class="app-button redirect">' + value + '</div>');
            
              });
              
              $(page).find("#contact-list").show();
              
              $(page).find(".redirect")
                  .clickable()
                  .on("click", function() {
                  
                  localStorage.setItem("to", $(this).html());
                  
                  App.load('sendEmail');
                  
                  
                  
              });
              
              
          } else {
              
              $(page).find("#contact-list").hide();
              
          }
          
	   }
	   
	 
   });
	
   App.controller('sendEmail', function(page){
	   //alert("sendEmail loaded");
	   
	   if(typeof localStorage !== "undefined"){
		   
		  if(localStorage.getItem('from') !== null){
			  $(page).find('#from').val(localStorage.getItem('from'));
		  }
		   
	   }
	   
	   
	   
	   $(page).find('#send').
	   clickable().on('click',function(){
		   
		   if(typeof localStorage !== "undefined"){
			   localStorage.setItem('from',$('#from').val());
			   
			   var reciepentList = new Array();
			   
			   if(localStorage.getItem('reciepent-list') !== null){
			   
			   reciepentList = JSON.parse(localStorage.getItem('reciepent-list'));
			   }
			   
			   if($.inArray($('#to').val(),reciepentList) == -1){
				   reciepentList.push($('#to').val());
				   reciepentList.sort();
				   localStorage.setItem('reciepent-list',JSON.stringify(reciepentList));
				   //alert("in array");
				   console.log(reciepentList);
			   }
			   
		   }
		   else{
			   alert("Email data couldn't be saved");
		   }
		   
	   })
	   
	 
   });
  
   
	
   try{
	   App.restore();
   }
	catch(err){
		App.load('home');
	}

I am getting error in these two lines of code:

   if(typeof localStorage !== "undefined"){
		   if (localStorage.getItem("reciepent-list") !== null) {

How to solve this issue. Any help would be highly appreciated.

Botões de Constraste

Fala Tiago, primeiro parabéns por essa iniciativa muito legal queria deixar uma dica pra você.

Não utilize o atributo title na tag pois nos leitores de tela isso tornara uma informação repetida e para um usuário que não enxerga isso mais atrapalha do que ajuda.

Recomendo utilizar o aria-label resolveria o problema, no caso do botão de aumento e diminuição de fonte, agora o botão de constraste não vejo necessidade porque ele é auto declarativo ele explica o propósito dele.

Lembrando que o atributo aria-label que faz parte da WAI-ARIA já é recomendação da W3C e pode ser usado e o NVDA, JAWS 13 e VoiceOver já interpretam ele, bom espero ter ajudado.

Abraço.

Validation for subject and message field is not working

I am creating an email app. First fill the from and to fields and then when click send that links via Ajax to a php script which then sends the e-mail and returns true and the app interprets this as a successful send. It will also validate the form before sending and the recipient email addresses which are used automatically appear in the email address list.

Everything is working except the subject and message. The validation for a subject and message is not working, even it's sending the mail without subject and message.

I have attached two files. Please go through the code.

indexxPage.txt
sendEmail

Any help would be appreciated.

Thanks

Can't use on angular

Describe the bug
I have imported accessibilityButtons as shown in the README, and it didn't casue any error:
import { accessibilityButtons } from 'accessibility-buttons/dist/js/accessibility-buttons';
But Calling accessibilityButtons() results in error Object(...) is not a function.
If this library does not work on angular please update your README.

To Reproduce
Steps to reproduce the behavior:

  1. Create Angular project
  2. import accessibilityButtons in a component
  3. call accessibilityButtons()
  4. See error

Expected behavior
The accessibilityButtons should be initiated

Enviroment (please complete the following information):

  • Windows
  • Opera

** Error message

main.ts:12 TypeError: Object(...) is not a function
  at new AppComponent (app.component.ts:42)
  at createClass (core.js:24584)
  at createDirectiveInstance (core.js:24400)
  at createViewNodes (core.js:35006)
  at createRootView (core.js:34878)
  at callWithDebugContext (core.js:36407)
  at Object.debugCreateRootView [as createRootView] (core.js:35644)
  at ComponentFactory_.create (core.js:23542)
  at ComponentFactoryBoundToModule.create (core.js:19549)
  at ApplicationRef.bootstrap (core.js:32042)

IE Edge issue - SCRIPT16389: SCRIPT16389: Unspecified error.

hi,

thanks for this wonderful plugin. The accessibility buttons are working fine in Chrome, but when i check the page in IE Edge, it is giving me following error:

SCRIPT16389: SCRIPT16389: Unspecified error.

Any clue how to solve it?

Thanks in advnce

ie-edge-issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.