vue-a11y / vue-focus-loop Goto Github PK
View Code? Open in Web Editor NEWVue component that helps you to to trap focus in an element.
Home Page: http://vue-focus-loop.surge.sh/
License: MIT License
Vue component that helps you to to trap focus in an element.
Home Page: http://vue-focus-loop.surge.sh/
License: MIT License
Hey, love this plugin, but it has a very glaring problem. I'm using it to constrain keyboard users from tabbing out of a modal dialog, but on presentation I need a specific, non-form element (#advice) to receive focus so screen readers will read its contents aloud.
But when my modal component is mounted, despite the fact that the last thing I'm doing in my mounted handler is forcing the focus onto #advice, the focus very shortly afterward (< 1s) is tabbed onto the first form element.
From an a11y perspective, this is Bad, because the screen reader skips the contents of #advice, not reading it -- in other words, not reading the instructions this element offers to the user who might not be able to read it.
Short of moving the contents of #advice into a textarea tag and restyling it to look the same to visual surfers it would be nice to flag my #advice element with something that FocusLoop could use to ensure this element is included for keyboard navigators.
When I enter the FocusLoop wrapped element, I need to do a double SHIFT + TAB in order to move to the last element. The first key combo does nothing. It's always only the first key combo—any other attempt works normal.
Tested on last Edge and Firefox.
The same behavior happens in the demo: Demo
Vue 3 no longer provides a use()
function on the global Vue object - plugins are installed on app instances.
So this line will throw an error:
Line 13 in 0060813
Right now, it seems that deactivating the focus loop will not return focus to the previously focused element. This seems like it would be a useful feature. I might be willing to look at making a PR for this feature if you think so?
The focus doesn't loop on mobile screen-reader.
The focus changes by swipe gesture then the tab key logic doesn't apply.
Tested on iOS with VoiceOver.
A possible workaround would be to add aria-visibility="hidden"
to all the page elements except the focus loop container.
sources:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.