Skip to content

Commit

Permalink
make bulk menu accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Feb 9, 2025
1 parent 067b2ec commit 8595ea9
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions fiduswriter/book/static/js/modules/books/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class BookOverview {
contentsEl.insertBefore(headerEl, tableEl)
}

this.dtBulk = new DatatableBulk(this, this.dtBulkModel)
this.dtBulk = new DatatableBulk(this, this.dtBulkModel, 2)

const hiddenCols = [0, 1]

Expand Down Expand Up @@ -274,6 +274,10 @@ export class BookOverview {
if (event.type === "keydown") {
const key = keyName(event)
if (key === "Enter") {
if (this.getSelected().length > 0) {
// Don't open. Let the bulk menu handle it.
return
}
const link = this.table.dom.querySelector(
`tr[data-index="${rowIndex}"] a.fw-data-table-title`
)
Expand All @@ -293,7 +297,7 @@ export class BookOverview {
} else {
if (
event.target.closest(
"span.fw-data-table-title, span.rights, span.delete-book"
"span.fw-data-table-title, span.rights, span.delete-book, label"
)
) {
return
Expand Down Expand Up @@ -472,23 +476,6 @@ export class BookOverview {
this.dom.addEventListener("click", event => {
const el = {}
switch (true) {
case findTarget(
event,
".entry-select, .entry-select + label",
el
): {
const checkbox = el.target
const dataIndex = checkbox
.closest("tr")
.getAttribute("data-index", null)
if (dataIndex) {
const index = Number.parseInt(dataIndex)
const data = this.table.data.data[index]
data.cells[2].data = !checkbox.checked
data.cells[2].text = String(!checkbox.checked)
}
break
}
case findTarget(event, ".delete-book", el): {
if (this.app.isOffline()) {
addAlert(
Expand Down

0 comments on commit 8595ea9

Please sign in to comment.