Event log: a double- or triple-click on an event's ID leaves it as it was
check / check (push) Successful in 3m13s
check / check (push) Successful in 3m13s
The first click of a double- or triple-click comes before its selection and toggled the event. A later click of it that finds text selected now puts the event back as it was before the first click. The browser test checks this with a triple-click on the ID, checks the caret and the row's aria-expanded both while the event is expanded and while it is collapsed, and reaches the row with Tab from the page's Back link before pressing Enter and Space. The event log's checks are split in three to stay within the length limit. Model: opus-5-5
This commit is contained in:
+18
-4
@@ -76,17 +76,31 @@ document.addEventListener("alpine:init", function () {
|
||||
window.Alpine.data("collapsible", function () {
|
||||
return {
|
||||
open: false,
|
||||
// Whether it was open before its latest single click, which
|
||||
// may be the first of a double- or triple-click.
|
||||
wasOpen: false,
|
||||
init() {
|
||||
this.open = this.$root.hasAttribute("data-open");
|
||||
},
|
||||
toggle() {
|
||||
this.open = !this.open;
|
||||
},
|
||||
// Toggles, except on a click that ends a text selection, such
|
||||
// as selecting an event's ID to copy it.
|
||||
toggleUnlessSelecting() {
|
||||
if (window.getSelection().toString() === "") {
|
||||
// Toggles on a click, except one that selects text, such as
|
||||
// selecting an event's ID to copy it. A double- or
|
||||
// triple-click selects its text on its second click, after
|
||||
// its first may have toggled, so a later click that finds
|
||||
// text selected puts back the state from before the first.
|
||||
toggleUnlessSelecting(event) {
|
||||
const selecting = window.getSelection().toString() !== "";
|
||||
|
||||
if (event.detail === 1) {
|
||||
this.wasOpen = this.open;
|
||||
}
|
||||
|
||||
if (!selecting) {
|
||||
this.toggle();
|
||||
} else if (event.detail > 1) {
|
||||
this.open = this.wasOpen;
|
||||
}
|
||||
},
|
||||
get closed() {
|
||||
|
||||
Reference in New Issue
Block a user