Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accessibility to Zoom buttons #21

Open
exodussystem opened this issue Jul 26, 2023 · 2 comments
Open

Add accessibility to Zoom buttons #21

exodussystem opened this issue Jul 26, 2023 · 2 comments

Comments

@exodussystem
Copy link

Currently the zoom buttons (+/-) are SVGs and some browser does not support focus for SVG.
We are working on application that supports accessibility and tabbing/focusable is a must.

It would be great if these buttons are focusable.
Thanks

@cotton123236
Copy link
Owner

Hi @exodussystem ,

I'm working on Zoomist v2 with TypeScript, and I'll take your advice on v2.
But for v1, maybe you can consider making your own buttons by using

const options = {
  inEl: '.custom-in-button',
  outEl: '.custom-out-button',
}

Thanks!

@exodussystem
Copy link
Author

exodussystem commented Aug 1, 2023

@cotton123236

Hi Wilson,

Thank you very much for your prompt reply.
We love your library and we are looking forward to Typescript version of this library.
I figured out that but I did not know where to put these custom elements.

Finally, I could make it work.
I post my codes here for anyone wants to do the same

HTML:

<div data-zoomist-src="assets/images/my-image.jpg">
    <div class="zoomist-zoomer">
      <a href="javascript:void(0);" class="zoomist-in-zoomer">
        <i class="fa fa-plus"></i>
      </a>
      <a href="javascript:void(0);" class="zoomist-out-zoomer">
        <i class="fa fa-minus"></i>
      </a>
    </div>
</div>

Javascript:

zoomer = {
        inEl:  '.zoomist-in-zoomer',
        outEl: '.zoomist-out-zoomer',
        disableOnBounds: true
    }

In order to get the focus, tag must have href attribute.
This would make clicking on these zoomer butons will open another page or reload the page.
I set href="javascript:void(0);" but this is not optimal solution.

If possible, in the zoomer handlers, adding "return false;" will stop the event propagation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants