gustafn
committed
on 05 Oct 22
Support for handler for double-click prevention via CSS class

This change makes it possible to provide a double click prevention for
HTML e… Show more
Support for handler for double-click prevention via CSS class

This change makes it possible to provide a double click prevention for

HTML elements via the CSS class "prevent-double-click". The double

click prevention deactivates a button or an anchor element after

clicking for a short time (per default for 1s) and ignores in this

time window further clicks. The time window can be specified via the

data element oacs-timeout. When a double click occurs, the duplicate

click is determined at the client side (in the browser) such that the

first request will continue to run and will render its result when

finished. Without double-click prevention (or with the

double-click-prevention on the server side), the results of the first

request are lost for the client, although these are still computed at

the server side.

Usage Example:

   <p>text with a <a class="prevent-double-click" data-oacs-timeout="2000" href="/slow.tcl?t=10s">link</a>

   <p>

   <form action="/slow.tcl">

   <input class="btn prevent-double-click" data-oacs-timeout="2000" type="submit" value="Submit">

   ...

   </form>

By reactivating the button automatically after the timeout, this

approach works also reasonable well when opening additional tabs or

browser windows.

The handler and implementation are designed to work with streaming

HTML, provided that "template::collect_body_scripts" is called (like

the reset of the template::* styling interface).

When HTML elements are deactivated, the DOM property "disabled" is set

as well as a CSS class "disabled".  Since disabled anchors are

visually not different from non-disabled anchors, this CSS class can

be used for styling disabled anchors differently.

Show less