@kubex/zinc 1.1.80 → 1.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,7 +188,24 @@ export default class ZnSlashMenu extends ZincElement {
188
188
 
189
189
  private scrollActiveIntoView() {
190
190
  const active = this.renderRoot.querySelector<HTMLElement>('[data-slash-item][aria-selected="true"]');
191
- active?.scrollIntoView({block: 'nearest'});
191
+ if (!active) return;
192
+
193
+ const items = this.visibleItems;
194
+ const panel = this.panel;
195
+
196
+ // The heading and footer scroll with the list, and `nearest` stops at the item's own box — so
197
+ // landing on the first or last item goes all the way to the panel's edge to bring them back
198
+ if (panel && items.slice(0, this.activeIndex).every(item => item.disabled)) {
199
+ panel.scrollTop = 0;
200
+ return;
201
+ }
202
+
203
+ if (panel && items.slice(this.activeIndex + 1).every(item => item.disabled)) {
204
+ panel.scrollTop = panel.scrollHeight;
205
+ return;
206
+ }
207
+
208
+ active.scrollIntoView({block: 'nearest'});
192
209
  }
193
210
 
194
211
  // mousedown, not click: preventDefault keeps focus (and the caret) in the field
@@ -216,6 +233,11 @@ export default class ZnSlashMenu extends ZincElement {
216
233
  protected updated(changed: PropertyValues) {
217
234
  super.updated(changed);
218
235
 
236
+ // A new list, or a reopen, starts at the top rather than wherever the last one was scrolled to
237
+ if (changed.has('items') || (changed.has('open') && this.open)) {
238
+ this.scrollActiveIntoView();
239
+ }
240
+
219
241
  if (changed.has('open') || changed.has('anchor')) {
220
242
  if (this.open) {
221
243
  this.startPositioner();
@@ -45,7 +45,7 @@ export default class ZnTranslations extends ZincElement implements ZincFormContr
45
45
  @property({attribute: "textarea-rows", type: Number}) textareaRows: number | undefined;
46
46
 
47
47
  /**
48
- * Quick insertions offered by the slash menu when `input-type` is `textarea`. Accepts a JSON array of items, or
48
+ * Quick insertions offered by the slash menu on `text` and `textarea` inputs. Accepts a JSON array of items, or
49
49
  * the shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Every language shares the list.
50
50
  */
51
51
  @property({