![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@q42/floating-focus-a11y
Advanced tools
An a11y focus solution that is clear, beautiful and easy to implement.
A clear, beautiful and easy to implement focus-state solution that improves accessibility in an aesthetically pleasing way.
With npm installed, run
$ npm install @q42/floating-focus-a11y --save
Import the package and instantiate the class on page load:
import FloatingFocus from '@q42/floating-focus-a11y';
new FloatingFocus(containerElement); // Element is an optional parameter which defaults to `document.body`
Define a default outline and outline-offset. Either of these values can be overruled per component:
/* Hide all default focus states if a mouse is used, this is completely optional ofcourse */
*:focus {
outline: none;
}
/* Default outline value, which will be applied to all elements receiving focus, this is a required step. */
/* The .focus class is used by the focus target, more below. */
.floating-focus-enabled :focus, .floating-focus-enabled .focus {
outline: dodgerblue solid 2px;
outline-offset: 8px;
}
/* Give all buttons a green focus state instead of dodgerblue, this is optional in case it's needed. */
.floating-focus-enabled [type="button"]:focus {
outline-color: green;
outline-offset: 4px;
}
Sometimes the actual element that receives focus is hidden from view, as is common with a custom input field. In this case it's possible to define a focus-target
attribute on the focusable element.
<input type="file" class="hidden" id="file-upload-123" focus-target="file-upload-123-label"/>
<label id="file-upload-123-label" for="file-upload-123">Please upload a file</label>
This will append the focus
class to the target element and make the visual focus box appear around the target element, instead of the element that actually has the native focus.
For convenience, the styles are included in the script by default. There is also an option to include the stylesheet separately. This is particularly useful with strict style-src 'self'
CORS headers.
Import unstyled dist file:
import FloatingFocus from '@q42/floating-focus-a11y/dist/unstyled';
The stylesheet can then be separately imported with your favorite CSS preprocessor:
@import '@q42/floating-focus-a11y/dist/unstyled';
$ npm run build
$ npm run watch
$ npm run test
# bump version
$ npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
# publish
$ npm publish
FAQs
An a11y focus solution that is clear, beautiful and easy to implement.
The npm package @q42/floating-focus-a11y receives a total of 634 weekly downloads. As such, @q42/floating-focus-a11y popularity was classified as not popular.
We found that @q42/floating-focus-a11y demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.