Skip to content

Commit baccd88

Browse files
authored
Add keyboard navigation for lists (#360)
resolves #106 ## blocked by: - Icinga/icingaweb2#5049
2 parents b3b8004 + eb20d59 commit baccd88

6 files changed

Lines changed: 575 additions & 199 deletions

File tree

library/Icingadb/Common/DetailActions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public function initializeDetailActions(): self
5151
})
5252
->registerAttributeCallback('data-icinga-multiselect-count-label', function () {
5353
return $this->getDetailActionsDisabled() ? null : t('%d Item(s) selected');
54+
})
55+
->registerAttributeCallback('data-icinga-multiselect-hint-label', function () {
56+
return $this->getDetailActionsDisabled()
57+
? null
58+
: t('Use shift/cmd + click/arrow keys to select multiple items');
5459
});
5560

5661
return $this;

library/Icingadb/Common/LoadMore.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ protected function getIterator(ResultSet $result): Generator
100100
->setAnchor('page-' . ($pageNumber))
101101
))
102102
->setLabel(t('Load More'))
103-
->setAttribute('data-no-icinga-ajax', true);
103+
->setAttributes([
104+
'class' => 'load-more',
105+
'data-no-icinga-ajax' => true
106+
]);
104107

105108
$this->add($showMore->setTag('li')->addAttributes(['class' => 'list-item']));
106109
}

public/css/common.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ div.show-more {
272272

273273
.selected-items {
274274
font-size: 1.25em;
275+
276+
&.hint {
277+
opacity: 0.75;
278+
}
275279
}
276280
}
277281

public/css/list/item-list.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
background-color: @gray-lighter;
99
}
1010

11-
.show-more:hover,
11+
.load-more:hover,
1212
.page-separator:hover {
1313
background: none;
1414
}
1515

16-
> .show-more a {
16+
> .load-more a {
1717
.rounded-corners(.25em);
1818
background: @low-sat-blue;
1919
text-align: center;
@@ -57,7 +57,7 @@
5757
.list-item {
5858
display: flex;
5959

60-
&.show-more a {
60+
&.load-more a {
6161
flex: 1;
6262
margin: 1.5em 0;
6363
padding: .5em 0;

0 commit comments

Comments
 (0)