This release brings many fixes and quality-of-life improvements that were requested by the community.
The vast majority of these changes are backward compatible. One breaking change can be found with making links followable. Existing usage is polyfilled by unpoly-migrate.js
.
[up-emit]
to emit an event when any element is clicked. In particular this works with a <button>
or any faux-interactive element (issue #416).Sometimes you need to add a click
listener to non-interactive elements (like <span>
). Unpoly helps you prevent accessibility issues with such "faux-interactive" elements, by offering the [up-clickable]
attribute and up.link.config.clickableSelectors
configuration.
Unpoly also leverages this for its own faux-interactive elements, such as [up-emit]
or [up-dismiss]
.
This release improves the handling of faux-interactive elements:
<span>
or <div>
.up.link.config.clickableSelectors
, by setting an [up-clickable=false]
attribute or configuring up.link.config.noClickableSelectors
.Space
and Enter
keys. Faux-interactive elements with a [role=link]
can only be activated with the Enter
key.[up-follow]
attribute now default to [role=link]
(instead of the default [role=button]
).[up-href]
attribute are no longer followable by default. They also require an [up-follow]
attribute or a match in up.link.config.followSelectors
. This change was made to remove confusion with other features that use [up-href]
, such as [up-defer]
and (since this release) [up-poll]
.[up-instant]
attribute are no longer followable by default. They also require an [up-follow]
attribute or a match in up.link.config.followSelectors
. This change was made to remove confusion with other features that use [up-instant]
, in particular up:click
on faux-interactive elements.up:fragment:poll
event can now inspect or mutate event.renderOptions
. This allows more control over the polling request and sub-sequent render passes.[up-poll]
elements can now use the [up-href]
attribute to poll from a different URL. By default Unpoly will poll the URL from which the element was originally loaded. The old method over overriding [up-source]
is still supported, but [up-href]
is the preferred way of doing this going forward.[up-poll]
elements can now use the [up-method]
attribute to choose a different HTTP method for polling requests.[up-poll]
elements can now use the [up-params]
attribute to add custom params to polling requests.[up-poll]
elements can now use the [up-headers]
attribute to add custom headers to polling requests.Enter
from a focused field (discussion #658).up.submit()
now includes the [name]
and [value]
of the default submit button in the submitted params. By default the form's first submit button will be assumed. You can prevent this with { submitButton: false }
, or pass a different button element as { submitButton }
.<sl-button>
(discussion #643).[up-defer]
elements no longer have a hand cursorup:link:follow
can now open a layer with a given mode using the shorthand notation event.renderOptions.layer = "new drawer"
.Uncaught AbortError
when the user presses the back button, but a script prevents the up:location:restore
event.Uncaught AbortError
when the user closes the overlay, but a script prevents the up:layer:dismiss
or up:layer:accept
event.
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.