Unpoly Show archive.org snapshot enhances your HTML with new attributes to build dynamic UI on the server. It works with any language and gracefully degrades without JavaScript.
The 3.9.0 release brings many fixes and quality-of-life improvements that were requested by the
community
Show archive.org snapshot
. The vast majority of these changes are backward compatible. One breaking change can be found with
making links followable
Show archive.org snapshot
. Existing usage is polyfilled by
unpoly-migrate.js
Show archive.org snapshot
.
Emitting events on buttons
- You can now use
[up-emit]
Show archive.org snapshot to emit an event when any element is clicked. In particular this works with a<button>
or any faux-interactive element Show archive.org snapshot (issue #416).
Improvements to faux-interactive elements
Sometimes you need to add a click
listener to non-interactive elements (like <span>
). Unpoly helps you
prevent accessibility issues
Show archive.org snapshot
with such "faux-interactive" elements, by offering the
[up-clickable]
Show archive.org snapshot
attribute and
up.link.config.clickableSelectors
Show archive.org snapshot
configuration.
Unpoly also leverages this for its own faux-interactive elements, such as
[up-emit]
Show archive.org snapshot
or
[up-dismiss]
Show archive.org snapshot
.
This release improves the handling of faux-interactive elements:
- A new documentation guide
Clicking non-interactive elements
Show archive.org snapshot
details all the methods to emulate interactivity on non-interactive elements like
<span>
or<div>
. - You can now define exceptions to
up.link.config.clickableSelectors
Show archive.org snapshot , by setting an[up-clickable=false]
attribute or configuringup.link.config.noClickableSelectors
Show archive.org snapshot . - Adjustae the handling of keyboard input to better match the behavior of real buttons and links. In particular, faux-interactive elements with a
button role
Show archive.org snapshot
(default) can be activated with both
Space
andEnter
keys. Faux-interactive elements with a[role=link]
can only be activated with theEnter
key. - Faux-interactive elements that also have the
[up-follow]
Show archive.org snapshot attribute now default to[role=link]
(instead of the default[role=button]
). - Faux-interactive elements with a button role no longer have the "hand" (or "pointer") cursor.
- Fix a bug where faux-interactive elements inside popups could not be activated with the keyboard (#653).
Making links followable
- Links with only an
[up-href]
Show archive.org snapshot attribute are no longer followable by default. They also require an[up-follow]
Show archive.org snapshot attribute or a match inup.link.config.followSelectors
Show archive.org snapshot . This change was made to remove confusion with other features that use[up-href]
Show archive.org snapshot , such as[up-defer]
Show archive.org snapshot and (since this release)[up-poll]
Show archive.org snapshot . - Links with only an
[up-instant]
Show archive.org snapshot attribute are no longer followable by default. They also require an[up-follow]
Show archive.org snapshot attribute or a match inup.link.config.followSelectors
Show archive.org snapshot . This change was made to remove confusion with other features that use[up-instant]
Show archive.org snapshot , in particularup:click
Show archive.org snapshot on faux-interactive elements Show archive.org snapshot .
Polling
- Listeners to the
up:fragment:poll
Show archive.org snapshot event can now inspect or mutateevent.renderOptions
. This allows more control over the polling request and sub-sequent render passes. -
[up-poll]
Show archive.org snapshot elements can now use the[up-href]
Show archive.org snapshot 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]
Show archive.org snapshot is still supported, but[up-href]
Show archive.org snapshot is the preferred way of doing this going forward. -
[up-poll]
Show archive.org snapshot elements can now use the[up-method]
attribute to choose a different HTTP method for polling requests. -
[up-poll]
Show archive.org snapshot elements can now use the[up-params]
attribute to add custom params to polling requests. -
[up-poll]
Show archive.org snapshot elements can now use the[up-headers]
attribute to add custom headers to polling requests.
Forms
- Focus is now preserved when submitting a form by pressing
Enter
from a focused field ( discussion #658 Show archive.org snapshot ). - The
up.submit()
Show archive.org snapshot 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 }
. - Fix an interop issue with the
Shoelace
Show archive.org snapshot
web component library, where a failed response could not be processed when the form was submitted with an
<sl-button>
( discussion #643 Show archive.org snapshot ).
Smooth scrolling
- Support smooth scrolling Show archive.org snapshot when swapping a fragment.
- Fix smooth scrolling when prepending or appending Show archive.org snapshot content.
Various
- Fix: up-alias not matching URL query string with asterix after shash (#542)
- Fix a bug where an overlay with viewport would not correctly shift multiple right-fixed elements
- [up-defer][up-href] elements no longer have a hand cursor
- Events like
up:link:follow
Show archive.org snapshot can now open a layer with a given mode Show archive.org snapshot using the shorthand notationevent.renderOptions.layer = "new drawer"
. - Avoid logging
Uncaught AbortError
when the user presses the back button, but a script prevents theup:location:restore
Show archive.org snapshot event. - Aboid logging
Uncaught AbortError
when the user closes the overlay, but a script prevents theup:layer:dismiss
Show archive.org snapshot orup:layer:accept
Show archive.org snapshot event. - Reduce the number of layer lookups Show archive.org snapshot during a render pass.