You can now control whether a focused fragment shows a visible focus ring.
Because Unpoly often focuses new content, you may see focus outline appear in unexpected places. Focus rings are important for users of keyboards and screen readers to be able to orient themselves as the focus moves on the page. However, mouse and touch users often dislike the visual effect of a focus ring.
To help your CSS show or hide focus rings in the right situation, Unpoly assigns CSS classes to the elements it focuses:
.up-focus-visible
class..up-focus-hidden
class instead.You can use these classes to hide unwanted focus rings, or style focus rings on new components.
The following supporting changes have also been made:
up.viewport.config.autoFocusVisible
to a function that decides if an element should get a .up-focus-visible
or .up-focus-hidden
class.up.event.inputDevice
. Its value is a string describing the class of input device used for the current task.:focus-visible
as it sets focus classes, but can only do so in some browsers.up.focus()
function accepts a new { focusVisible }
option to control whether .up-focus-hidden
or .up-focus-visible
is set on a focused element.See Focus ring visibility for more details and examples.
This release addresses many edge cases with features that watch form fields for changes, in particular [up-watch]
, [up-autosubmit]
and up.watch()
:
[up-autosubmit]
would not work on forms that also have dependent fields using [up-validate]
.[up-autosubmit]
now aborts a debounce delay if either the form element or the form's target are aborted. It no longer aborts the delay if any watched field is aborted.up.on()
takes a { capture: true }
option to register a listener that runs before the event is emitted on the element.{ behavior: 'instant' }
to prevent picking up a scroll-behavior
CSS property. To do pick up the property, pass { behavior: 'auto' }
.up.form.isField()
. It returns whether the given element is a form field.
If you're upgrading from an older Unpoly version you should load unpoly-migrate.js
to polyfill deprecated APIs.
Changes handled by unpoly-migrate.js
are not considered breaking changes.
See our upgrading guide for details.